Movable Type exposes a number of different template tags called container tags that loop over a set of objects. This allows designers to display for example the last 10 entries on a blog, or to display each of the comments associated with an entry.
As Movable Type iterates or loops over a list of objects in this fashion it maintains a number of meta variables for you, allowing you to test if the current item is an odd or even item in the list for example. Listed below are all the meta variables Movable Type maintains:
Note: Each of these variables is preceded and followed by two (2) underscores.
__even__- returns true if the current item in the list is even__odd__- returns true if the current item in the list is odd__first__- returns true if the current item in the list if the first item in the list__last__- returns true if the current item in the list if the last item in the list__counter__- returns the index of the current item in the list
Example
<mt:Entries lastn="10">
<mt:if name="__first__"><ul></mt:if>
<li class="entry <mt:if name="__even__">even<mt:else>odd</mt:if>">
<mt:var name="__counter__">. <mt:EntryTitle>
</li>
<mt:if name="__last__"></ul></mt:if>
</mt:Entries>
Related
<mt:Entries><mt:Pages><mt:Authors><mt:Blogs><mt:Categories>- etc... and all other block/loop tag in movable type
3 User Contributed Notes
This should really be linked from each of the relevant loops, such as Entries. A lot of people don't know about them, and right now, it's being relied upon for them to come into the designer's guide, which presumes a certain interpretation, eg. in most of my client relationships, I would probably identify as the admin, not designer.
Thanks Su. I've added a link under Related Entries on all the major loop/block tags in the documentation, and added the tag "block" to this page.
FYI: These meta-variables are not available under dynamic publishing.