让dede织梦:arclist支持notypeid属性的方法

织梦默认的arclist标签支持typeid的调用,也就是给文章列表指定来源栏目,有时候栏目过多,一个一个写就很复杂,所以用排除的方法写更方便,以此引入notypeid属性。 主要修改文件是/include/taglib/
下的arclist.lib.php
文件,首先搜索: return lib_arclistDone
在函数末尾加上:,$ctag->GetAtt('notypeid')
,原来的代码变成如下的样子:

return lib_arclistDone 

       ( 

         $refObj, $ctag, $typeid, $ctag->GetAtt('row'), $ctag->GetAtt('col'), $titlelen, $infolen, 

         $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), $listtype, $orderby, 

         $ctag->GetAtt('keyword'), $innertext, $envs['aid'], $ctag->GetAtt('idlist'), $channelid, 

         $ctag->GetAtt('limit'), $flag,$ctag->GetAtt('orderway'), $ctag->GetAtt('subday'), $ctag->GetAtt('noflag'), 

         $tagid,$pagesize,$isweight,

$ctag->GetAtt('notypeid')         

     );
然后再搜索function lib_arclistDone,同样在这个函数的后面加上一句代码:,$notypeid=0,修改后的函数变成下面的样子:

function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160, 

        $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='', 

        $innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='', $order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0, $isweight='N',$notypeid=0)

***后,搜索以下代码:$orwheres[] = ' arc.arcrank > -1 ';,在这个代码的前面加入如下代码:

if(!empty($notypeid))  

{ 

    $orwheres[] = " and arc.typeid NOT IN (".GetSonIds($notypeid).")"; 

}

上传覆盖之后即可使用arclist的notypeid属性,使用方法如下:

{dede:arclist row=6 orderby=pubdate notypeid='7,8,9'}

让dede织梦:arclist支持notypeid属性的方法

意思是按更新时间,调用除了栏目id是7,8,9的其余栏目中的6条数据。