smartyのsectionとかloopの回数取得なら!
{section name=counter loop=$array_data start=2 step=2 max=10} {if $smarty.section.counter.first} {* 最初のループ時にtrueになります *} 最初のデータ {/if} {if $smarty.section.counter.last} {* 最後のループ時にtrueになります *} 最後のデータ {/if} {$smarty.section.counter.index} {* 現在のループインデックス Zero Originです。*} {$smarty.section.counter.index_prev} {* 前ループのインデックス値 *} {$smarty.section.counter.index_next} {* 次ループのインデックス値 *} {$smarty.section.counter.iteration} {* 現在のループ回数 1 Originです。*} {$smarty.section.counter.rownum} {* 現在のループ回数 1 Originです。(iterationと同じ) *} {$smarty.section.counter.loop} {* 最後のインデックス値 *} {$smarty.section.counter.total} {* ループした回数 *} {$array_data[counter]} {* 配列の値 *} {sectionelse} データが無いよ。{/section
引用: