Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-05 13:46:34

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 252
Website

if_different usage

Hello,
I can’t grasp the meaning and usage of if_different.
Mainly, does it check whether any txp:tag contained therein has different value from the same istance of the previous txp:tag?

thanks…

Offline

#2 2011-01-05 13:53:02

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: if_different usage

Close. It checks the value of its contents.

<txp:if_different><txp:posted format="%Y" /></txp:if_different>

If the above code is in an article form, the first article will cause the code to show the year the article was posted. Subsequent articles will not output the code if they were posted in the same year as the first. When an article with a different year comes through the form, the year will be shown again. That resets the “if_different” stack and subsequent articles will compare against the new value.


Code is topiary

Offline

Board footer

Powered by FluxBB