Reputation: 2590
I working on smarty template.
I need to have numbers to my list array
So I tried
{foreach} {$num} {/foreach}
Which prints 0 1 2 3 4 5 ........
I want my numbers to starts from 1 & not 0
How can I achieve this?
OR
Is there any other way to do it ?
Thanks
Upvotes: 1
Views: 104
Reputation: 1754
{foreach} {$num|assign:$num+1} {$num} {/foreach}
or
{foreach}{assign var=newnum value=$num+1} {$newnum} {/foreach}
Upvotes: 1