Example of section nested loop usage of smarty, smartysection
This article describes how to use the section nested loop of smarty. We will share this with you for your reference. The details are as follows:
{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> <FONT color = # ffffff> <B> {$ typeList [sec1]. typeName} </B> </FONT> </TD> <TD vAlign = top width = 70 height = 25> <a href = "hot.html"> </a> </TD> </TR> </TBOD Y> </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 "> </a> </td> </tr> </table> </td> </tr> <td class = "hongzi" align = "middle"> <a href = "a01.htm"> {$ typeList [sec1]. shop [sec2]. name} </a> </td> </tr> <td class = "zi2" align = "middle"> quantity: {$ typeList [sec1]. shop [sec2]. num} </td> </tr> <td class = "zi2" align = "middle"> price: {$ typeList [sec1]. shop [sec2]. price} White Gold Coins </td> </tr> </table> </td >{/ section} </tr> </table >{/ section}
Use $ typeList [sec1]. shop of sec1 as the loop of sec2.
You can get the content of the array in the shop.