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條經驗 獲得超8個贊
foreach 沒有跳出的這個
如果有這種需求,建議使用
{section},{sectionelse}
max integer No 1 設定循環最大執行次數.
添加回答
舉報
0/150
提交
取消