largeQ
1 $arr= array(2array('id'=>1,'title'=>'title1'),3array('id'=>2,'title'=>'title2'),4array('id'=>3,'title'=>'title3')5 );67$smarty->assign('news',$arr);1 {section name=sn loop=$news}2 {if $smarty.section.sn.first}3<table>4<th>id</th>5<th>title</th>6 {/if}7<tr>8<td>{$news[sn].id}</td>9<td>{$news[sn].title}</td>10</tr>11 {if $smarty.section.sn.last}12</table>13 {/if}14 {sectionelse}15 there is no news.16 {/section}显示结果如下(是一个表格的样子,以下显示的没有加样式):1 id title2 1 title13 2 title24 3 title3