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

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

概述找到 \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,typen

找到 \include\taglib\channelartList.lib.PHP,  查找 $attList

将 
$attList = 'typeID|0,row|20,cacheID|';
修改为:
$attList = 'typeID|0,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,128' 中的 123,128 为114的子栏目
 

修改后的channelartList.lib.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,notypeid|0';    FillAttsDefault(->CAttribute->Items,0) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; wIDth: auto !important; Box-sizing: content-Box !important; Font-size: 1em !important; background: none !important;">$attList);extract(= trim(->GetInnerText());$artList '';//读取固定的缓存块$cacheID $cacheID);(!=) {        = GetCacheBlock();        $artList) return ;}    (empty$typeID)){$typeID = ( !->Typelink->TypeInfos['ID']) ?  ] : 0 );}    $innertext==) = GetSystemplets('part_channelartList.htm');$totalnum = $row;$totalnum)) = 20;  //获得类别ID总数的信息$typeIDs = array();==0 || 'top') {$tpsql " reID=0 And ispart<>2 And ishIDden<>1 And channeltype>0 ";}else{(!ereg',')) {            " reID='$typeID' And ispart<>2 And ishIDden<>1 ";        }else {" ID in($typeID) And ispart<>2 And ishIDden<>1 ";}}    //否定指定ID$notypeid!=0) {$tpsql."and not(ID in($notypeid)) ";}    ->Setquery("Select ID,sitepath                                             from `dede_arctype` where order by sortrank asc limit ");->Execute();while$row ->GetArray()) {$typeIDs[] = ;}  (!isset([0])) return ;  $GLOBALS['itemindex'] = 0;'itemparity'] = 1;for$i=0;isset([]);++){]++;$pv new PartVIEw(][]);$pv->FIElds['typeurl'] = GetoneTypeUrlA(]);->SetTemplet('string');.= ->GetResult();] = (]==1 ? 2 : 1);}//注销环境变量,以防止后续调用中被使用'envs''typeID'] = ];'reID'] = ;) {WriteCacheBlock();};}?> ?  
总结

以上是内存溢出为你收集整理的修改dede源码,让dede:channelartlist排除指定typeid全部内容,希望文章能够帮你解决修改dede源码,让dede:channelartlist排除指定typeid所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/1066208.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存