Smarty标签 for运算
$select="SELECT {$col_name} FROM woke_order where deleted=0 ".$where.$orderby ; // 取出数组 $rows=array(); $result=$db->query($select); while($row=$db->fetch_array($result)) { $rows[]=$row; } $smarty->assign('rows',$rows); $smarty->display('GridView_TaskList.tpl');//显示模板
<table> <{foreach $rows as $k=>$v}> <tr <{if $v@first}> bgcolor="blue" <{/if}> > <td><{$v@iteration}> </td> <td><{$v.contact_name}> </td> <td><{$v.date_entered}> </td> </tr> <{/foreach}> </table>