许多朋友在使用织梦建站的时候,由于网站栏目过多,并且开设有二级栏目,想让在首页调用指定顶级栏目内容且不包含该栏目下的二级栏目内容,通常的使用方法都不太理想,这里互补网为大家推荐notypeid属性,即可方便的过滤和排除掉子栏目,仅调用顶级栏目内容。
具体实现方法如下:
我们首先需要修改php文件,找到/include/taglib/arclist.lib.php文件
找到以下代码,大约在130行
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 );
修改为以下代码:
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'),$ctag->GetAtt('notypeid'), $tagid,$pagesize,$isweight );查找以下代码:
function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160, $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='', $innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='', $order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0, $isweight='N')
修改为以下代码
function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160, $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='', $innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='', $order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0,$notypeid=0, $isweight='N')然后查找$orwheres[] = ' arc.arcrank > -1 ';代码
在其下增加以下代码
if(!empty($notypeid)) { $orwheres[] = " and arc.typeid NOT IN (".GetSonIds($notypeid).")"; }到这里我们的php文件就已经修改完成,具体的arclist调用中,使用notypeid排除过滤栏目的方法如下:
{dede:arclist row=6 orderby=pubdate typeid='1' notypeid='9'}注明:其中notypeid=‘9’意思是,排除ID为9的栏目