php+Smartyで以下のようなforを実現したい時のテンプレートの書き方をメモ。 マニュアル見る限りではできないものと思われがちなんだけど実はできるという(/ω\) #いつも処理をしようと思うたびにぐぐってるので・・・。 php版でこれを・・・ for($i=0;$i<10;$i++){ echo "$i<br>"; } Smarty版 {section name=cnt loop=10} {$smarty.section.cnt.iteration-1}<br> {/section} //※-1するのがポイント とか {section name=cnt loop=10} {$smarty.section.cnt.index}<br> {/section} または {section name=cnt start=0 loop=10} {$smarty.section.cnt.index
