foreach
The {foreach}
tag will allow you to loop through an array of data.
The easiest example is looping through Navigation items.
<ul>
{foreach from=$navData item=item}
<li>{$item.label}</li>
{/foreach}
</ul>
Index
Sometimes you want to output the current position within the loop. This is accessed by first
adding a name=foo
to your foreach, then printing {$smarty.foreach.foo.index}
Example
{* this will output 0|1, 1|2, 2|3, ... etc *}
{foreach from=$navData item=i name=foo}
{$smarty.foreach.foo.index}. {$i.label}
{/foreach}