New conditional tags

There are three new conditional tags in the 4.0 branch: if_first_article, if_last_article and if_different.

<txp:if_first_article> and <txp: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.

<txp: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 template:

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


  1. Hi Alex,

    please help me, I don’t get what you mean by the sentence “When repeated, it will display its contents only if it’s different to the last time”. There are too many unknowns in it.
    I don’t see, what has to be different from what? What is meant by “the last time”? The last time the database of this article has changed/the page has been requested/ I have visited the page? What is repeated, as you say in the beginning of the sentence?

    I think the example is not ideal as it complicates understanding by requiring the comprehension of an external source.

    In the example: what exactly needs to change to make a difference? Where can I find the criterion for “change”? Is it the content of the container tag, a change of the date format? No, this is not what I’d expect. Does the code simply display a date if anything is changed? How would the code look like if I want to display something once a week?
    Is the permlink line after the closing tag necessary for my comprehension?
    Maybe I would understand many things better if the output of both cases (not changed / changed) would be shown.

    So, perhaps, could you make things a little clearer, please?

    Regards, Uli

Commenting has expired for this article.