找到 \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的子栏目
if
(!defined(
'DEDEINC'
))
exit
(
'Request Error!'
);
function
lib_channelartlist(&
$ctag
,&
$refObj
)
{
$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(
PHP variable" style="font-family: Consolas,EXTR_SKIP);
$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'
) {
}
else
{
(!
ereg
','
)) {
" reid='$typeid' And ispart<>2 And ishidden<>1 "
;
}
else
{
" id in($typeid) And ispart<>2 And ishidden<>1 "
;
}
}
//否定指定ID
$notypeid
!=0) {
}
->SetQuery("Select id,sitepath
from `dede_arctype` where
order by sortrank asc limit
");
->Execute();
while
$row
->GetArray()) {
$typeids
[] =
;
}
@H_403_378@