Dotiac::DTL::Tag::ifnotequal - The {% ifnotequal VARIABLE1 VARIABLE2 %} tag
{% ifnotequal post.date comment.date %} {{ comment.date|timesice:post.date }} ago {% else %} At the same time {% endifnotequal %}
Compoares two variables, and if they are NOT equal, the content is rendered.
If they are not equal and an optional {% else %} block is found, that block is rendered.
If given an array or hash, it will only compare the length (like perl does), since there is no default array or hash comparision (This will change with perl6)
So you can write:
{% ifnotequal loop 3 %} Loop has not three elements {% endifnotequal %}
But to stay compatible with Django, you should write:
{% ifnotequal loop|length 3 %} Loop has not three elements {% endifnotequal %}
If you want to compare the content, use this:
{% ifnotequal loop|stringformat:"s" otherloop|stringformat:"s" %} ... {% endifqual %}
Warning: This might be quite slow, that's why it isn't default.
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.