This macro is used for iterating on object collections:
.foreach_item (collection [,head [,tail [,condition [,comparison]]]]) complex-template .next [(separator)]
The template specified inside the block is applied to all objects contained in the specified collection.
If a comparison is specified, items in the collection are pre-sorted according to the corresponding rule before being iterated upon.
The following parameters are available:
Parameter |
Description |
---|---|
collection |
Collection over which iteration is performed Type: Simple template |
head |
[optional] Generated before output, if there is one Type: Text |
tail |
[optional] Appended to the output, if there is one Type: Text |
condition |
[optional] If specified, only objects satisfying the given condition are considered during the iteration Type: Simple condition |
comparison |
[optional] evaluated in a scope where two local objects respectively named 'Item1' and 'Item2' are defined. These correspond to items in the collection. <comparison> should evaluate to true if Item1 is to be placed after Item2 in the iteration Type: Simple condition |
complex-template |
Template to apply to each item. Type: Complex template |
separator |
[optional] Generated between non empty evaluations of <complex-template> Type: Text |
Example: