找到 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 ;
$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( ]);
|