Σtemplate example 2: block iteration

1. Simple block iteration

Basic parse() example. Filling a list from an array.

2. Nested block iteration

Let's fill a HTML table from a two-dimensional array.

{table_item}

3. Menu-like structures

This is used to output a sequence of elements that may have different presentation, consider things like normal and selected elements in menu. The much more complex example is the ITDynamic renderer of HTML_QuickForm.

4. Methods to manually control removal of blocks

touchBlock() is used to show the blocks that would be considered empty and therefore will be removed.

{touch_stuff} {touch_quantity} This row is intentionally left blank (and thus should be removed)

hideBlock() is used to hide the blocks that would be shown due to their non-empty status, in this case 'edit' links.

5. Using get() to move blocks around

If you need a copy of a block somewhere else in the template...

This is a copy of the block from section 1:

{duplicate}