
Dotiac::DTL::Tag::importloop - The {% importloop ARRAYOFHASHES [reversed] [merge] [contextvars] %} tag

Variables:
posts=>[
{Title=>"test",Content="A test post",Date=>time},
{Title=>"My first post",Content="Nothing to say here",Date=>time-3600}
]
Template file:
{% importloop posts %}
<h1>{{ Title }}</h1> {# Title is now in the main namespace #}
{{ Content|linebreaks }}
<em>{{ Date|date:jS F Y H:i" }}</em>
{% empty %}
No entries
{% endimportloop %}

Iterates over a an ARRAY OF HASHES and imports those hashes into the top-level namespace.
If the loop is empty and an {% empty %} tag is given, it will run the templatecode from {% empty %} to {% endimportloop %}.
This tag works almost like HTML::Template's TMPL_LOOP tag.
If reversed is put after the source the list/array is reversed before the iteration
If merge is given, the namespace is not replaced (default), but merged with the content of the hash.
Similar to HTML::Template's loop_context_vars option, adds some variables into the namespace about the loop
True if this is the first iteration
True if this is neither the first nor the last iteration.
True if this is the last iteration.
If there is only one iteration, __first__ and __last__ are both true, but not __inner__
The current iteration, 1 indexed.
True on the first line and every other line (first, third, fifth and so on)

Also sets importloop.key if iterating over a hash.

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