|
80端口悄悄提示:数据载入中…… |
|
| Re:如何用SmartTemplate实现嵌套循环? |
模版: <html> <body> <table border="1"> <!-- BEGIN List --> <tr> <td width="112">{NAME}--{ID}</td> <td width="303"> </td> </tr> <!-- BEGIN List1 --> <tr> <td> </td> <td>{NAME}--{ID} </td> </tr> <!-- END List1 --> <!-- END List --> </table> </body> </html> 程序代码: <?php include_once('ASSinit.php'); $tpl = new SmartTemplate("cs.htm"); $List[0]['NAME']="一级分类"; $List[0]['ID']="1"; $List[0]['List1'][0]['NAME']="二级分类"; $List[0]['List1'][0]['ID']="11"; $List[1]['NAME']="一级分类2"; $List[1]['ID']="2"; $List[1]['List1'][0]['NAME']="二级分类"; $List[1]['List1'][0]['ID']="21"; $tpl->assign("List",$List); $tpl->output(); ?> |
|