NAME

Dotiac::DTL::Tag::ifequal - The {% ifequal VARIABLE1 VARIABLE2 %} tag

SYNOPSIS

        {% ifequal post.date comment.date %}
                At the same time
        {% else %}
                {{ comment.date|timesice:post.date }} ago
        {% endifequal %}

DESCRIPTION

Compoares two variables, and if they are equal, the content is rendered.

If they are not equal and an optional {% else %} block is found, that block is rendered.

BUGS AND DIFFERENCES TO DJANGO

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:

        {% ifequal loop 3 %}
                Loop has three elements
        {% endifequal %}

But to stay compatible with Django, you should write:

        {% ifequal loop|length 3 %}
                Loop has three elements
        {% endifequal %}

If you want to compare the content, use this:

        {% ifequal loop|stringformat:"s" otherloop|stringformat:"s" %}
                ...
        {% endifqual %}

Warning: This might be quite slow, that's why it isn't default.

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