smarty使用math、section、foreach


4、
    <{if $smarty.foreach.frh_1.total < 10}><{assign var=frh_2_total value=11}><{else}><{assign var=frh_2_total value=$smarty.foreach.frh_2.total}><{/if}>
    <{if $smarty.foreach.frh_2.total < 10}>
        <{section name=frh_left2 start=$frh_2_total loop=21 step=1}>
            <dd class="b"><strong class="n<{$smarty.section.frh_left2.index}>"><{$smarty.section.frh_left2.index}></strong><span>-------</span><em>--</em><a href="javascript:void(null)">+加为好友</a></dd>
        <{/section}>
    <{/if}>


3、{assign var=”title” value=$title|default:”no title”}

2、<{math equation="x + y" assign="frh_2_total" x=$smarty.foreach.frh_2.total y=1}>

1、//$smarty.section.section的名字.index是一个特殊变量,用来显示当前循环的位置
{section name=foo start=10 loop=20 step=2}
  {$smarty.section.foo.index}
{/section}
<hr />
{section name=bar loop=21 max=6 step=-2}
  {$smarty.section.bar.index}
{/section}

//输出:
10 12 14 16 18
<hr />
20 18 16 14 12 10
300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00631 秒