muban大师 发表于 2021-2-23 09:22:15

怎样让织梦DEDECMS的dede:channelartlist语句解除指定typeid

在做织梦模板时,在行使 dede:channelartlist 自动挪用栏目内容时,常常会碰着某些栏目不必要挪用,好比“关于我们”、“接洽地点”等无一连更新的栏目。要想在dede:channelartlist挪用时倾轧某些栏目,这必要修改dede源码,让dede:channelartlist解除指定typeid。
       
        起首找到 \include\taglib\channelartlist.lib.php]出于安详思量先备份这个文件。打开channelartlist.lib.php 查找 $attlist
       
        将
        $attlist = 'typeid|0]row|20]cacheid|';
        修改为:
        $attlist = 'typeid|0]row|20]cacheid|,notypeid|0'; // 此处添加了一个所要解除typeid的参数—notypeid
       
        再查找:
       
        $dsql->SetQuery("Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl]sitepath from `idea_arctype` where $tpsql order by sortrank asc limit $totalnum");
        在其前面添加(留意是在前面添加):
       
        //否认指定ID if($notypeid!=0) { $tpsql = $tpsql."and not(id in($notypeid)) "; }
        生涯文件后,再模板挪用时:
       
        {dede:channelartlist typeid ='1' notypeid='2,3,4,5'}
       
        个中notypeid=’2,3,4,5′ 中的 2,3,4,5 为 1 的子栏目即见效。
页: [1]
查看完整版本: 怎样让织梦DEDECMS的dede:channelartlist语句解除指定typeid