Smarty How to nest Loops

Source: Internet
Author: User
Tags smarty template
Smarty How do I nest loops? This paper mainly introduces the section nested loop usage of smarty, and analyzes the implementation technique of nested loop operation using section in the form of simple example, and the friends who need can refer to the smarty. We hope to help you.

Specific 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> <FO NT color= #ffffff ><b>{$typeList [sec1].typename}</b></font></td> <td vAlign=top width= href= "hot.html" ><a" height= "border=0></a>" </TD> </TR></TBODY></TABLE> <table cellspacing= "0" cellpadding= "0" > <tr> {sectio       n name= "sec2" loop= $typeList [Sec1].shop} <td><table cellspacing= "0" cellpadding= "0" > <tr>          &LT;TD valign= "center" align= "Middle" width= "$" ><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> <tr> <td class= "Hongzi" align= "middle" > <a href= "a01.htm" >{$typeList [SEC1]. Shop[sec2].name} </a> </td> </tr> <tr> <td class= "Zi2" align= "middle" > Quantity: {$t Ypelist[sec1].shop[sec2].num} </td> </tr> <tr> <td class= "Zi2" align= "Middle" > Price : {$typeList [Sec1].shop[sec2].price} white gold </td> </tr> </table></td>{/section} </tr> </table>{/section}

SEC1 's $typeList [sec1].shop as a sec2 loop

You can fetch the contents of the array in the shop.

Related recommendations:

How smarty templates use variable conditioners

Smarty How to generate simple form elements

An explanation of how the Smarty template engine caches

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.