How do you increment an assigned variable in smarty without displaying it

前端 未结 4 1746
Happy的楠姐
Happy的楠姐 2020-12-29 18:54

So I have an assigned variable in smarty:

{assign var=number value=0}

Now I can increment it using

{$number++}
4条回答
  •  佛祖请我去吃肉
    2020-12-29 19:03

    If I had to do this I would do something like the following: {php}$number++{/php} but it is very ugly to have to use php in a smarty template. This might suggest that there is a better way of doing what you planned to do.

提交回复
热议问题