SPEEDPHP 后台列表页调用分类名称

写一个函数:

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}>"}>

需要传参数

posted @ 2013-05-09 11:02  网络剑客  阅读(166)  评论(0)    收藏  举报