Warning: include(/home/eliseb/public_html/includes/head.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 6 Warning: include(): Failed opening '/home/eliseb/public_html/includes/head.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 6 Warning: include(/home/eliseb/public_html/includes/banner.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 9 Warning: include(): Failed opening '/home/eliseb/public_html/includes/banner.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 9 Warning: include(/home/eliseb/public_html/includes/mainmenu.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 10 Warning: include(): Failed opening '/home/eliseb/public_html/includes/mainmenu.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 10

« Date Formats | Main | Creating an Additional Weblog »

Previous Entries and Lastn

Updated February 22, 2007

The default main index page of a Movable Type weblog displays the last 10 entries made. You can change this number by entering a different number in the weblog's settings. Settings > General > Default Weblog Display Settings > Entries to Display

You can also change the default settings so that they display the last X number of days worth of entries.

lastn
Outside of the default set up, if you want to display a certain number of entries, you need to use the lastn attribute.

Changing <MTEntries> to <MTEntries lastn="7"> in the Main Index template will cause the index page to display the last 7 entries. Adding the attribute lastn="10" will cause the index page to display the last 10 entries, and so forth.

Previous Entries
Sometimes it is useful to show a list of the most recent entries that came before the entries that are displayed on your main index page. Rather than creating a super long page with 17 entries, you might want to display 7 entries and show a list of the 10 entries that came before, with links to their corresponding full entries.

To show a list of previous entries you need to employ the "offset" attribute. For example, if you wanted to show a list of the 10 entries that came before your 7 most recent entries, you would use a tag that looked like this:

<MTEntries lastn="10" offset="7">

The code that I have used on various blogs looks something like this:

<h3>Previous 10 entries...</h3>
<MTEntries lastn="10" offset="7">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> <$MTEntryDate format="%b %e, %Y"$><br />
</MTEntries>

This code I've placed right after the </MTEntries> tag that is the closing tag for the MTEntries section of code that governs the main display of entries on the page.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Warning: include(/home/eliseb/public_html/includes/sidebar.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 142 Warning: include(): Failed opening '/home/eliseb/public_html/includes/sidebar.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 142 Warning: include(/home/eliseb/public_html/includes/footer.php): failed to open stream: No such file or directory in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 143 Warning: include(): Failed opening '/home/eliseb/public_html/includes/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.learningmovabletype.com/archives/000293previous_entries_and_lastn.php on line 143