织梦dede:channelartlist调用排除指定typeid栏目

在制作织梦模板的时候,要想在 dede:channelartlist 调用时排出某些栏目,这需要修改dede源码,让 dede:channelartlist 排除指定typeid。
打开 include aglibchannelartlist.lib.php 文件
找到
$attlist = 'typeid|0,row|20,cacheid|';
修改为:
$attlist = 'typeid|0,row|20,cacheid|,notypeid|0'; // 此处添加了一个所要排除typeid的参数—notypeid
找到
$dsql->SetQuery("Selectid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath from `dede_arctype` where $tpsql order by sortrank asc limit $totalnum");
在其前面添加
//否定指定ID
if($notypeid!=0) {
     $tpsql = $tpsql."and not(id in($notypeid)) ";
}
模板调用:
{dede:channelartlist typeid ='7' notypeid='8'}
其中notypeid=’8′ 中的 8 为 7 的子栏目即生效。
当然notypeid和typeid也可以分开各自使用.

来源:https://www.jianshu.com/p/b40205f50cd1

原文地址:https://www.cnblogs.com/init-007/p/11337862.html