if_different
The if_different tag is a conditional tag and always used as an opening and closing pair, like this…
<txp:if_different>
...conditional statement with <txp:other_tag>...
</txp:if_different>
The tag will execute the contained statement when the value of the contained statement differs from the preceding value for that contained statement. Can be used in article, link, comment, and file forms.
Display posting time per article once per day
<txp:if_different>
<!-- heading - only once per day -->
<h3><txp:posted format="%d %B %Y" /></h3>
</txp:if_different>
Other tags used: posted
Build an indented list of article titles grouped by section
Intention:
Desired result:
In a page template, add this tag to loop through all articles from all sections:
<txp:article_custom sort="section ASC, Title ASC" form="tree" />
The contents of the tree form used by the snippet above lists all article titles and renders an intermittent heading element whenever a different section is encountered while the articles loop through:
<txp:if_different><h2><txp:section title="1" /></h2></txp:if_different>
<txp:title />
Other tags used: article_custom, section