Zblog:如何在首页调用不同栏目的列表数据?
因为有些主题的原因,一些新加栏目不能按照需求,在首页调出部分列表数据。我们可以这样做:
1.找到该主题的include.php文件,在该文件最后添加代码如下:
注意:
San_Tiger_GetArticleCategorys函数名中,需要将 San_Tiger换成网站所正在用的主题名
function San_Tiger_GetArticleCategorys($Rows,$CategoryID,$hassubcate){
global $zbp;
$ids = strpos($CategoryID,",") !== false ? explode(",",$CategoryID) : array($CategoryID);
$wherearray=array();
foreach ($ids as $cateid){
if (!$hassubcate) {
$wherearray[]=array("log_CateID",$cateid);
}else{
$wherearray[] = array("log_CateID", $cateid);
foreach ($zbp->categorys[$cateid]->SubCategorys as $subcate) {
$wherearray[] = array("log_CateID", $subcate->ID);
}
}
}
$where=array(
array("array",$wherearray),
array("=","log_Status","0"),
);
$order = array("log_PostTime"=>"DESC");
$articles= $zbp->GetArticleList(array("*"),$where,$order,array($Rows),"");
return $articles;
}


