The Movable Type Knowledge Base

Lastn Does Not Work Properly With MTArchiveList

Question

The lastn attribute, when used with the MTArchiveList tag, produces an incorrect number of archives. (Version 3.2)

Answer

As an example, if you specify the following:

<MTArchiveList archive_type="Monthly" lastn="6">

the tag only returns the last two months, instead of the last six.

The way to get around this until the bug is resolved is to multiple the lastn value you want by three:

<MTArchiveList archive_type="Monthly" lastn="18">

and that should actually give you only the last six monthly archives.

This bug can also affect the MTArchiveListFooter tag if used inside the MTArchiveList container, by causing it to not recognize when the last archive in the list is reached. If you want to use this tag and also impose a lastn value on MTArchiveList, multiple the lastn value you want by three and then subtract one:

<MTArchiveList archive_type="Monthly" lastn="17">

and that will give you the last six monthly archives as well as cause the MTArchiveListFooter tag to behave correctly.


Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or questions. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Support.

Yahoo! Small Business web hosting services

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.