手册上有:
Foreach-loops also have their own variables that handle foreach properties. These are indicated like so: {$smarty.foreach.foreachname.varname} with foreachname being the name specified as the name attribute of foreach 即:
{foreach name="myForeach" from=$list item=i}
{if $smarty.foreach.myForeach.last}This is the last item.{/if}
{/foreach}

解决方案 »

  1.   

    你好,我的手册确实没有这段示例,我是翻了很多遍才来问的,我的手册有很多中文的
    你能把你用的这个发给我么?谢谢E-Mail: [email protected]
      

  2.   

    额!我也遇到了这个问题,其实是不知道
    {$smarty.foreach.foreachname.varname}
    中varname是指什么,中文手册上还真没有~看来要去翻E文版了~
      

  3.   

    额,我表示我学习的不够,总算看到上面的了
    Table of Contents目录 
    iteration 
    first 
    last 
    show 
    total
    都是varname属性~