加入收藏 | 设为首页 | 会员中心 | 我要投稿 莱芜站长网 (https://www.0634zz.com/)- 云连接、建站、智能边缘云、设备管理、大数据!
当前位置: 首页 > 综合聚焦 > CMS系统 > 正文

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

发布时间:2020-07-09 08:15:29 所属栏目:CMS系统 来源:互联网
导读:找到 includetaglibchannelartlist.lib.php, 查找$attlist 将 $attlist = typeid|0,row|20,cacheid|; 修改为: $attlist = typeid|0,row|20,cacheid|,notypeid|0; [此处添加了一个所要排除typeid的参数---notypeid] 查找: $dsql-SetQuery(Select id,typen

找到 includetaglibchannelartlist.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($innertext = 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();
}
;
}
?>
?

(编辑:莱芜站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读