标签:
{foreach name=foreach_name key=k item=v from=$arr}
{$k}=>{$v}<br/>
{/foreach}
{section name=sec_name loop=$arr start=0 step=n max= m show=true/false }
{if is_array($arr[sec_name])}
{section name=sec2 loop=$arr[sec_name]}
{$arr[sec_name][sec2]}<br/>
{/section}
{esle}
{$arr[sec_name]}<br/>
{/if}
{$smarty.section.sec_name.index}{*当前循环下标,默认为0,例如0,1,2,3...*}
{$smarty.section.sec_name.index_prev}{*当前循环下标的前一个值,index为0时,index_prev为-1*}
{$smarty.section.sec_name.index_next}{*后一个值,默认为1*}
{$smarty.section.sec_name.first}{*是否为第一个循环,是为true*}
{$smarty.section.sec_name.last}{*是否为最后一个循环*}
{$smarty.section.sec_name.iteration}{*当前行号,如1,2,3,4...*}rownum是iteration的别名
{$smarty.section.sec_name.loop}{*最后一个循环号,数组元素为7个,实际循环4次(例:max=4),loop仍然显示为7*}
{$smarty.section.sec_name.total}{*实际循环次数*}
max规定最大循环次数;
show是否显示这部分内容;决定是否对这块进行显示
{/section}
标签:
原文地址:http://www.cnblogs.com/feng12345/p/5457039.html