Smartyを使ったとき、数字を選ばせるselectをいちいち書くのが面倒だなと思って、forみたいなことができないかなと調べました。

ツꀀSmartyでfor文みたいな動きをさせるには(@みるくぜりー

8時から18時を選ばせるselect

<select name=”mte_hour” id=”mte_hour” {if $error.mte_hour}class=”errorinput” {/if}>
ツꀀツꀀツꀀツꀀ {section name=cnt start=8 loop=19}
ツꀀツꀀ<option value=”{$smarty.section.cnt.index}”{if $data.mte_hour == $smarty.section.cnt.index} selected{/if}>{$smarty.section.cnt.index}</option>
ツꀀツꀀ{/section}
ツꀀツꀀ</select>時

0分から55分を5分単位で選ばせるselect

<select name=”mte_minite”ツꀀ id=”mte_minite” {if $error.mte_minite}class=”errorinput” {/if}>
ツꀀツꀀツꀀツꀀ {section name=cnt start=0 loop=60}
ツꀀツꀀツꀀツꀀ {if $smarty.section.cnt.index%5 == 0}
ツꀀツꀀ<option value=”{$smarty.section.cnt.index}”{if $data.mte_hour == $smarty.section.cnt.index} selected{/if}>{$smarty.section.cnt.index}</option>
ツꀀツꀀ{/if}
ツꀀツꀀ{/section}
ツꀀツꀀ</select>分