smarty 月のプルダウン

phpファイル

$month=date('n');
$o_smarty->assign("month",$month);
$o_smarty->display("monthtest.tpl");

テンプレートファイル

<select name="month">
<option value="">--</option>
<{section name="sel_month" start=1 loop=13}>
<option value="{$smarty.section.sel_month.index|escape}"{if $month == $smarty.section.sel_month.index} selected="selected"<{/if}>{$smarty.section.sel_month.index|escape}
<{/section}>
</select>月
タイトルとURLをコピーしました