5 回答

qq_笑_17
TA贡献1818条经验 获得超7个赞
{section name=loop loop=$count}id: {$loop}{/section} 给count赋个值$smarty->assign(\'count\', 5);用一段section模拟:{section name=loop loop=$count}id: {$smarty.section.loop.index}{/section}

富国沪深
TA贡献1790条经验 获得超9个赞
<tr>
{section name="list" loop="$newslist"}
<td>
{$newslist[list].title}
</td>
<!--index 从0开始记 具体含义参考smarty手册-->
{if $smarty.section.list.index eq 4}
</tr><tr>
{/if}
{/section}
</tr>

largeQ
TA贡献2039条经验 获得超7个赞
foreach 没有跳出的这个
如果有这种需求,建议使用
{section},{sectionelse}
max integer No 1 设定循环最大执行次数.
添加回答
举报
0/150
提交
取消