SMARTY教程_在ecshop循环中获取一个会自动增加的数
发布时间:12/03 来源: 浏览:
关键词:
本篇教程只是起到一个敲门砖的作用,其他细节还需要自己发挥。
注意红色部分,
<!-- {foreach from=$helps item=help_cat name=help_list} -->
<ul class="help{$smarty.foreach.help_list.iteration}">
<li class="title">{$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} -->
红色部分的 {$smarty.foreach.help_list.iteration} 就是那个能自动增长的数字,是从1开始循环,每次加1。