Dotiac::DTL::Tag::ifchanged - The {% ifchanged [VARIABLE] %} tag
Template file:
{% for x in loop %} {% ifchanged %} Posted on {{ x.date }} {% endifchanged %} {% ifchanged x.poster %} Reply by {{ x.poster }} on {{ x.date }} {% endifchanged %} {% endfor %}
Without VARIABLE, ifchanged only renders its content, if the content changed since the last iteration of a loop above.
With VARIABLE, ifchanged only renders its content, if VARIABLE has changed since the last iteration of a loop above.
Every ifchanged stands on its own, even if they have the same variable or content to check.
{% ifchanged x.post %} ... {# This will be displayed #} {% endifchanged %} {% ifchanged x.post %} ... {# This will also be displayed #} {% endifchanged %}
This implementation also supports the {% else %} tag in ifchanged, which is not included in Django, but there is a patch for that.
{% for timepoint in timepoints %} {% ifchanged timepoint.day %} It's a new day. {% else %} It's still {{ timepoint.day }} {% endifchanged %} {% endfor %}
http://www.djangoproject.com, Dotiac::DTL
Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.
Marc-Sebastian Lucksch
perl@marc-s.de
To install Dotiac::DTL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dotiac::DTL
CPAN shell
perl -MCPAN -e shell install Dotiac::DTL
For more information on module installation, please visit the detailed CPAN module installation guide.