Tuesday 27 September 2005 by zem

There are three new conditional tags in the 4.0 branch:

<txp:if_first_article> ... </txp:if_first_article>

<txp:if_last_article> ... </txp:if_last_article>

<txp:if_different> ... </txp:if_different>

if_first_article and if_last_article work as the names suggest: when placed inside an article form, they’ll display their contents only on the first or last article in a <txp:article /> or <txp:article_custom /> list.

if_different can be used in any kind of list (article, link list, etc). When repeated, it will display its contents only if it’s different to the last time. For example, here’s an a quick archive list organized by month:

page template:

<txp:article_custom form="month_list" limit=5000 />

“month_list” form:

<!-- heading - only once per month -->
<h3><txp:posted format="%B %Y" /></h3>
<txp:permlink><txp:title /></txp:permlink><br />