Repeating sections

Templates often need to repeatedly process the same piece of code, using different values each time.

For example, channel summary pages need to iterate through each feed item being shown, inserting the content and other details for each one into the page. This is done by using the {%REPEAT%} tag.


The previous example doesn't handle the case of more than one author being specified for a channel, so we'll fix that using a repeating section.

    {%REPEAT% author}
        {%?CHANNEL-METADATA% author/email}
            <a href="mailto:{%@% encode=sgml chars=<&\"}">
            {%CHANNEL-METADATA% author encode=sgml chars=<&\"}
        {%?CHANNEL-METADATA% author/email}
    No author was specified!

Awasu now repeats the template code enclosed by the {%REPEAT%} and {%/REPEAT%} tags, one time for each instance of the specified metadata value found (in this case, author).