smarty的section嵌套循环一例

{section name="sec1" loop=$typeList}
            <TABLE class=left20 height=25 cellSpacing=0 cellPadding=0 width=624
            background=images/indexbg.gif border=0>
              <TBODY>
              <TR>
                <TD class=zi align=left width=554 height=25>&nbsp;&nbsp;<FONT
                  color=#ffffff><B>{$typeList[sec1].typeName}</B></FONT></TD>
                <TD vAlign=top width=70 height=25><a href="hot.html"><IMG src="images/more.gif" width="53" height="25"
              border=0></a></TD>
              </TR></TBODY></TABLE>
            <table cellspacing="0" cellpadding="0">
              <tr>
{section name="sec2" loop=$typeList[sec1].shop}
                <td><table cellspacing="0" cellpadding="0">
                    <tr>
                      <td valign="center" align="middle" width="116"><table cellspacing="0" cellpadding="0">
                          <tr>
                            <td><a href="show_prop.php?id={$typeList[sec1].shop[sec2].id}" target="_blank"><img src="http://mygame.tom.com/{$typeList[sec1].shop[sec2].img_url}" width="84" height="88" border="0"></a></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td class="hongzi" align="middle"> <a href="a01.htm">{$typeList[sec1].shop[sec2].name} </a> </td>
                    </tr>
                    <tr>
                      <td class="zi2" align="middle">数量:{$typeList[sec1].shop[sec2].num} 个 </td>
                    </tr>
                    <tr>
                      <td class="zi2" align="middle">价格:{$typeList[sec1].shop[sec2].price} 白金币 </td>
                    </tr>
                </table></td>
{/section}

                </tr>
            </table>
            {/section} 

 

将sec1 的 $typeList[sec1].shop 作为sec2的loop

就可以取到shop其中的数组的内容

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值