使用DedeCMS时,arclist标签有属性typeid,有时候我们希望调用一个栏目的文章,又不想调用其某些子栏目的文章,就需要修改一下arclist标签的源代码
打开/include/taglib/arclist.lib.php文件
1、修改函数lib_arclist的返回值
$tagid,$pagesize,$isweight
改为
$tagid,$pagesize,$isweight,$ctag->GetAtt('notypeid')
return lib_arclistDone
(
$refObj, $ctag, $typeid, $ctag->GetAtt('row'), $ctag->GetAtt('col'), $titlelen, $infolen,
$ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), $listtype, $orderby,
$ctag->GetAtt('keyword'), $innertext, $envs['aid'], $ctag->GetAtt('idlist'), $channelid,
$ctag->GetAtt('limit'), $flag,$ctag->GetAtt('orderway'), $ctag->GetAtt('subday'), $ctag->GetAtt('noflag'),
$tagid,$pagesize,$isweight,$ctag->GetAtt('notypeid')
);
2、修改函数lib_arclistDone
①参数中增加$notypeid=0
②找到下面的代码
$orwheres[] = ' arc.arcrank > -1 ';
在其后增加代码
if(!empty($notypeid))
{
$orwheres[] = " and arc.typeid NOT IN (".GetSonIds($notypeid).")";
}
使用方法:
{dede:arclist row=‘10’ typeid=‘1’ notypeid=‘10’ titlelen=‘60’}