21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
require_once('config/config.php');
$arr = array(
array('id'=>5,'title'=>'title1'),
array('id'=>8,'title'=>'title2'),
array('id'=>3,'title'=>'title3')
);
$smarty->assign('news',$arr);
$smarty->display('test.htm');
?>
<HTML><HEAD>
<TITLE>测试</TITLE>
</HEAD>
{section name=n loop=$news}
<{$news[n].title}>
<{$news[n].id}><br>
没有数据
{/section}
</html>
<HTML><HEAD>
<TITLE>测试</TITLE>
</HEAD>
<{section name=n loop=$news}>
<{$news[n].title}>
<{$news[n].id}><br>
没有数据
<{/section}>
</html>