您有个知识币

【退出】

smarty中foreach索引

使用smarty模板时偶尔会用到索引,因用的时候不是很多,很容易忘记,在此做个记号。

{foreach name=top from=$top_goods item=goods}

{$smarty.foreach.top.iteration}

<a href="/{$goods.url}" title="{$goods.name|escape:html}">

<img src="/{$goods.goods_img}" alt="{$goods.name|escape:html}"/></a>

{/foreach}

这里 $smarty.foreach.top.iteration 就是smarty foreach取得索引的方法。

 

本文固定链接: http://www.webzhishi.com/smarty-foreach/ | web知识网

smarty中foreach索引:目前有1 条留言

  1. 影楼网销培训:  

    学习一下了啊

    2012-03-19 12:04:38 [回复]

发表评论