smarty中for循环

smarty中for循环

<table>

      <tr>

      <td align="right">生 日:</td>
      <td>
       <select name="year">
<option value="">请选择年</option>
{{assign var=i value=1900}}
{{section name=total loop=114}}
{{assign var=i value=$i+1}}
<option value="{{$i}}" {{if $birthyear==$i}}selected{{/if}}>{{$i}}</option>
{{/section}} 
</select>

       <select name="month">
<option value="">请选择月</option>
{{assign var=i value=0}}
{{section name=total loop=12}}
{{assign var=i value=$i+1}}
<option value="{{$i}}" {{if $birthmonth==$i}}selected{{/if}}>{{$i}}</option>
{{/section}} 
</select>

       <select name="day">
<option value="">请选择日</option>
{{assign var=i value=0}}
{{section name=total loop=31}}
{{assign var=i value=$i+1}}
<option value="{{$i}}" {{if $birthday==$i}}selected{{/if}}>{{$i}}</option>
{{/section}} 
</select>
      </td>

</tr>

</table>

    A+
发布日期:2014年06月05日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: