I am not usually a Smarty guy, so I\'m a bit stuck.
I want to echo the index of an array, but I want to increment it each time I echo it.
This is what I have...<
You can use {counter}
{counter}
is used to print out a count.{counter}
will remember the count on each iteration. You can adjust the number, the interval and the direction of the count, as well as determine whether or not to print the value. You can run multiple counters concurrently by supplying a unique name for each one. If you do not supply a name, the name “default” will be used
source : http://www.smarty.net/docsv2/en/language.function.counter.tpl
Usage :
{counter start=0 print=false assign="count"}
{foreach from=$listing.products item="product"}
{counter}
{if $count === 1}
Count is 1
{/if}
{/foreach}