开发者

Generating {$num} inside {foreach}

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开发者_JAVA百科 starts from 1 & not 0

How can I achieve this?

OR

Is there any other way to do it ?

Thanks


{foreach} {$num|assign:$num+1} {$num} {/foreach}

or

{foreach}{assign var=newnum value=$num+1} {$newnum} {/foreach}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜