SmartTemplate学习笔记(6) $page->assign( 'users', $users ); $page->output(); ?> HTML模版 代码: <style type="text/CSS技巧">CSS"> .col0 { background-color: #D0D0D0; } .col1 { background-color: #F0F0F0; } </style> <table border="1" cellpadding="2" cellspacing="0"> <tr> <th> No </th> <th> Username </th> <th> Usergroup </th> </tr> <!-- BEGIN users --> <tr class="col{ROWBIT}"> <td> {ROWCNT} </td> <td> {NAME} </td> <td> {GROUP} </td> </tr> <!-- END users --> </table> 最后的输出 代码: <style type="text/css"> .col0 { background-color: #D0D0D0; } .col1 { background-color: #F0F0F0; } </style> <table border="1" cellpadding="2" cellspacing="0"> <tr> <th> No </th> <th> Username </th> <th> Usergroup </th> </tr> <tr class="col0"> <td> 0 </td> <td> John Doe </td> <td> ADMIN </td> </tr> <tr class="col1"> <td> 1 </td> <td> Jack Doe </td> <td> SUPPORT </td> </tr> <tr class="col0"> <td> 2 </td> <td> James Doe </td> <td> GUEST </td> </tr> <tr class="col1"> <td> 3 </td> <td> Jane Doe </td> <td> GUEST </td> </tr> </table> ☆smartTemplate的方法 注:以下列出的方法并不会在模版设计中出前,他们属于smartTemplate的代码编辑部分,但是如果为了实现更深一步的模版设计,下面的内容是肯定有用的.