写一个函数:
class lj extends spController
{
//后台资讯列表调用分类
function pdresult($cat_fid) {
$arr = $cat_fid;
$tiaojian = array('id' => $arr['cat_fid']);
$homeconobj = spClass('lib_article_cat');
$homere = $homeconobj->findAll($tiaojian, 'id DESC', null, 1);
foreach ($homere as $homepl) {
echo $homepl['catname'];
}
}
}
$pdresult = array("lj", "pdresult");
spAddViewFunction('pdresultview', $pdresult);
在模板里面调用:
<{pdresultview cat_fid="<{$one.cat_fid}>"}>
需要传参数