开发者

Generating {$num} inside {foreach}

开发者 https://www.devze.com 2023-01-10 04:36 出处:网络
I working on smarty template. I need to have numbers to my list array So I tried {foreach}{$num}{/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

精彩评论

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