Building design templates - repeating blocks
Repeating blocks are a bit more complicated than place holders. The content within a repeating block is dublicated a number of times. Most people familiar with programming would call this a loop. This is useful when building templates for a dynamic amount of data items like the navigation menu consisting of multiple links.
<!-- REPEAT SMMenuLevel1 -->
<a href="{[SMMenuItemLevel1 Url]}">{[SMMenuItemLevel1 Title]}</a>
<!-- /REPEAT SMMenuLevel1 --> |
In the example above we see that both a repeating block and place holders are in play. Repeating blocks are defined using the HTML comment markup. A repeating block is defined with a start (<!-- REPEAT MyRepeatingBlock -->) and an end (<!-- /REPEAT MyRepeatingBlock -->) - notice the slash. The content within these blocks will be repeated/dublicated by an extension. In the example above links are created with the use of some place holders, to specify the link reference and link title. Note that both repeating blocks and place holders are case sensitive.
In the
example section we use the repeating blocks to create a navigation menu. For further information, a study of the
template engine might be helpful, to fully understand the use of repeating blocks and place holders.