ECshop循环中获取一个会自动增加的数字
在ECSHOP中通过以下方法一样可以实现:
|
1
2
3
4
5
6
7
8
|
<!-- {foreach from=$helps item=help_cat name=help_list} --> <ulCOLOR: #ff0000"> {$smarty.foreach.help_list.iteration} "> <li>{$help_cat.cat_name}</li> <!-- {foreach from=$help_cat.article item=item} --> <li><a href="{$item.url}" title="{$item.title|escape:html}">{$item.short_title}</a></li> <!-- {/foreach} --> </ul> <!-- {/foreach} --> |
说明:
<!-- {foreach from=$helps item=help_cat name=goods_list} -->
<ulCOLOR: #ff0000"> {$smarty.foreach.goods_list.iteration} ">红色部分代码 {$smarty.foreach.goods_list.iteration} 就是那个能自动增长的数字,是从1开始循环,每次加1。
注意,红色代码中的 goods_list 要与上面绿色代码一样。不同的调用要不同的命名。
比如网站底部帮助信息,可以是:
<!-- {foreach from=$helps item=help_cat name=help_list} -->
<ulCOLOR: #ff0000"> {$smarty.foreach.help_list.iteration} ">
此方法在.dwt/.lbi 文件中都有效。

浙公网安备 33010602011771号