Marc - Sebastian Lucksch > Dotiac-0.8 > Dotiac::DTL::Tag::ifchanged

Download:
dotiac/Dotiac-0.8.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.8   Source   Latest Release: Dotiac-0.8_1

NAME ^

Dotiac::DTL::Tag::ifchanged - The {% ifchanged [VARIABLE] %} tag

SYNOPSIS ^

Template file:

        {% for x in loop %}
                {% ifchanged %}
                        Posted on {{ x.date }}
                {% endifchanged %}
                {% ifchanged x.poster %}
                        Reply by {{ x.poster }} on {{ x.date }}
                {% endifchanged %}
        {% endfor %}

DESCRIPTION ^

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.

Note

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 %}

BUGS AND DIFFERENCES TO DJANGO ^

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 %}

SEE ALSO ^

http://www.djangoproject.com, Dotiac::DTL

LEGAL ^

Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.

AUTHOR ^

Marc-Sebastian Lucksch

perl@marc-s.de

syntax highlighting: