DedeCMS增加notypeid屬性以實現過濾欄目

使用DedeCMS時,arclist標籤有屬性typeid,有時候我們希望調用一個欄目的文章,又不想調用其某些子欄目的文章,就需要修改一下arclist標籤的源代碼

打開/include/taglib/arclist.lib.php文件
1、修改函數lib_arclist的返回值

$tagid,$pagesize,$isweight

改爲

$tagid,$pagesize,$isweight,$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')
             
           );

2、修改函數lib_arclistDone
①參數中增加$notypeid=0
在這裏插入圖片描述
②找到下面的代碼

$orwheres[] = ' arc.arcrank > -1 ';

在其後增加代碼

if(!empty($notypeid))
        {
                $orwheres[] = " and arc.typeid NOT IN (".GetSonIds($notypeid).")";
        }

使用方法:
{dede:arclist row=‘10’ typeid=‘1’ notypeid=‘10’ titlelen=‘60’}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章