让dede:channelartlist支持channelid调用。 如:{dede:channelartlist channelid=’1′}
解决:打开include/taglib/channelartlist.lib.php
1. 找到代码
//处理标记属性 | innertext
$attlist = ‘typeid|0,row|20,cacheid|’;
修改成
$attlist = ‘typeid|0,row|20,cacheid|,channelid|’;
2. 找到
//获得类别ID总数的信息
$typeids = array();
if($typeid==0 || $typeid==’top’) {
$tpsql = ” reid=0 AND ispart2 AND ishidden1 AND channeltype>0 “;
}
else
{
if(!preg_match(‘#,#’, $typeid)) {
$tpsql = ” reid=’$typeid’ AND ispart2 AND ishidden1 “;
}
else {
$tpsql = ” id IN($typeid) AND ispart2 AND ishidden1 “;
}
}
在其后增加
if (!empty($channelid)) {
$tpsql .= ” and channeltype in ($channelid)”;
}
这个语句必须加在之后,
$dsql->SetQuery(“SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `dede58_arctype` WHERE $tpsql ORDER BY sortrank ASC LIMIT $totalnum”);
语句以前。 标红了增加语句,请仔细比较,以免混淆!