修改dede源码,让dede:channelartlist排除指定typeid

找到 \include\taglib\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 `dede_arctype` where $tpsql order by sortrank asc limit $totalnum");

在其前面添加(注意是在前面添加):

//否定指定ID
if($notypeid!=0) {
     $tpsql = $tpsql."and not(id in($notypeid)) ";
}

模板调用:
{dede:channelartlist typeid ='114' notypeid='123,124,125,126,127,128'}
其中notypeid='123,124,125,126,127,128' 中的 123,124,125,126,127,128 为114的子栏目
 

修改后的channelartlist.lib.php
 

<?php
 
if(!defined('DEDEINC')) exit('Request Error!');
require_once(DEDEINC.'/arc.partview.class.php');
 
function lib_channelartlist(&$ctag,&$refObj)
{
    global $dsql,$envs,$_sys_globals;
 
    //处理标记属性、innertext
    $attlist = 'typeid|0,row|20,cacheid|,notypeid|0';
    FillAttsDefault($ctag->CAttribute->Items,$attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $artlist = '';
    //读取固定的缓存块
    $cacheid = trim($cacheid);