Help - Search - Members - Calendar
Full Version: Index displays last 5 entries
Movable Type Community Forum > Additional Resources > Tips and Tricks
shiden4
The way I have my blog set up right now is that it will display whatever entries made during the past 7 days. Some blogs that I've visited seem as if though they display a certain x amount of entries, regardless of the number of days elapsed.

For example, the last 5 entries made will always be in view regardless of the date the last entry was published -- whether that be 3 days or 30 days ago.

I must be over-looking a simple option or something mellow.gif
Thena
The code you want to us is:

CODE
<MTEntries lastn="5">


You can find more about the options for MTEntries here. I use a combination of the lastn and offset tags so the last 2 entries are displayed in full with exceprts from the next 5 entries.
shiden4
Hey thanks biggrin.gif

The link you provided is very helpful, I'm going to implement some of those in my comments template.
arbtree
How do you display last n entries for multiple blogs on my server? Is this a plugin rather than a tag? Thanks!
LisaJill
Do you want them interspersed as if they were on the same blog, or do you want them seperate?

For ones that are interspersed (sorted by date as if they all came from the same weblog) check out MTGlobalEntries.

To have them seperate (their own list) then you can try MTOtherblog
arbtree
Many thanks - MTGlobalEntries is what I am after. I am really struggling with tags. I'm finding it much easier to copy and paste pre-made code that I'm finding on the boards here (with these examples I'm learning more about how to correctly write the code). I find the tags in the help files but actually making the code without errors seems more of a challenge. What I am after would seem like fairly basic tags for a main blog page...

If anyone has any premade code for the following, I would be very appreciative if I can copy and paste...

1. MTBlogs - list of all blogs in the MT installation on one server (I'm hoping to give blogs to different users and so would like an automatic list to be generated)
2. RecentGlobalComments - latest n comments across all blogs
3. MTGLobal Entries - latest n entries across all blogs

Lastly, I will be setting up multiple blogs for different users but would like them all to have the same template for the index page. Is there a global index page I should edit to esnure all new weblogs get the same index template? Many thanks in advance for sucha helpful forum. biggrin.gif
arbtree
Also, instead of MTGlobalEntries is there code for a list of "recently updated weblogs" from my server? Thanks again
LisaJill
Here's my code for global comments

CODE
<MTGlobalComments lastn="20" sort_order="descend">
<table border="5" bordercolor="#ffffcc" cellpadding="5" width="350">
<tr>
<td valign="top" width="70">
<b><$MTCommentAuthorLink show_email="0"$></b> <br />
<$MTCommentDate format="%b %e, %Y"$></a><br /><$MTCommentDate format=" %l:%M %p"$></td>
<td valign="top">
<MTFirstNWords n="20" append="..." keep_trailing="?!."><MTCommentBody convert_breaks="0"  apply_macros="1"></MTFirstNWords>
<MTCommentEntry><br /><br />
[<a href="<MTEntryLink archive_type="Individual" >" target="blank">read: <$MTEntryTitle$></a>]</td>
</MTCommentEntry><br />
</MTGlobalComments>


My code for global entries is a bit more confusing, because each of my weblogs is displayed differently and I'm using MTCompare to do that, but it may help;


CODE
<MTGlobalEntries include_blogs="1,8,9" lastn="7">

    
<MTIfEqual a="[MTBlogID]" b="8" numeric="1">

    
<MTOtherBlog blog_id="1">
<$MTInclude module="Post Header"$>
</MTOtherBlog>

<img src="<MTBlogURL><MTEntryCategory dirify="1">/<$MTEntryBody$>.jpg" alt="<MTEntryMore encode_html="1">"  />
    <br /><br />
<div class="tinytext">    <$MTEntryMore$> </div>
    <br />

    <MTOtherBlog blog_id="1">
<$MTInclude module="Post Footer"$>
</MTOtherBlog>    <MTEntryCategories>
| <a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a>
</MTEntryCategories>

</div>
  </MTIfEqual>
<MTIfEqual a="[MTBlogID]" b="1" numeric="1">

    
<MTOtherBlog blog_id="1">
<$MTInclude module="Post Header"$>
<$MTInclude module="Post Body"$>
<$MTInclude module="Post Footer"$>
</MTOtherBlog>    

<MTEntryCategories>
| <a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a>
</MTEntryCategories>

</div>
  </MTIfEqual>
<MTIfEqual a="[MTBlogID]" b="9" numeric="1">
    
<MTOtherBlog blog_id="1">
<$MTInclude module="Post Header"$>
<$MTInclude module="Post Body"$>
<$MTInclude module="Post Footer"$>
</MTOtherBlog>    

<MTEntryCategories>
| <$MTCategoryLabel$>
</MTEntryCategories>
    
</div>
  </MTIfEqual>
    </MTGlobalEntries>


basically, for globalentries, just replace MTEntries with MTGlobalEntries and add the blog_id's you want included (as per above). Make sure you change the closing MTEntries tags too. =)

and check out this thread for info on modifying the global index template. Make sure you backup first =)
arbtree
Thanks, with the MTGlobal plugin these tags worked for me. I didn't use the include_blogs as I wanted to include all blogs and that worked also.

How could I change the link so that instead of going to the archives when you click on globalentries you go to that blog's main page?

And looked but couldn't see a tag that would let me list all blogs on my server.

Also, the tutorial on changing the default tameplate worked too (watch out for that tip to add an extra / for any ') to avoid errors.

Thanks again for such a helpful board. wink.gif
LisaJill
You would have to make it so that the permalink pointed to I think. You could use if/then statements to only do that for included blogs, rather than the main weblog....

would take some playing =) would need mtcompare for the if/then idea...
arbtree
Thanks that did it. Changed permalink
drewament
QUOTE (Thena @ Jan 26 2004, 12:49 AM)
I use a combination of the lastn and offset tags so the last 2 entries are displayed in full with exceprts from the next 5 entries.

Could I by chance have a copy of this code. It is pretty close to what I need. I am sure I can modify it to my exact needs.

--Drew
kadyellebee
Something like this should do it:
CODE
<MTEntries lastn="2">
<$MTEntryBody$>
</MTEntries>
<MTEntries offset="2" lastn="5">
<$MTEntryExcerpt$>
</MTEntries>

Add any other MTEntry* tags you want. smile.gif

Kristine
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.