織夢cms可以將一個文章放入到2個欄目,一個是文檔主欄目,一個是文檔副欄目,而最終的管理是在主欄目中,但是被放入到副欄目的文檔同樣是可以在副欄目的前臺列表頁中展示,這樣就方便了一些有特殊欄目要求的需求。但問題來了,經(jīng)常我們不僅僅是需要在列表頁中去展示,也需要在首頁或者其他頁面中展示,這樣就需要用到了arclist這樣一個標(biāo)簽來進行調(diào)用。但是,你會發(fā)現(xiàn),默認(rèn)在arclist中是無法直接調(diào)用副欄目的文檔出來的。
其原因就是因為arclist標(biāo)簽文件中相關(guān)的php代碼函數(shù)不支持副欄目的調(diào)取,這個時候只需要將相關(guān)的代碼進行更改,就可以讓arclist支持副欄目的調(diào)用了。如何修改,可以參考以下解決方案中提供的大媽直接替換。
第一步:查找根目錄下/include/taglib/arclist.lib.php這個文件
第二步:打開arclist.lib.php后,找到大概在261行代碼的地方,將以下代碼
$orwheres[] = " arc.typeid in ($typeid) ";
替換成以下代碼
$vicewheres = ""; foreach($typeid as $tid){ $liketypeid2 = ",".$tid.","; $vicewheres.= " or CONCAT(',',arc.typeid2,',') like '%$liketypeid2%' "; } if($vicewheres!="") $orwheres[] = " (arc.typeid in ($typeid) $vicewheres) "; else $orwheres[] = " arc.typeid in ($typeid) ";
第三步:在找到大概在303行代碼的地方,將以下代碼
if ($CrossID=='') $orwheres[] = ' arc.typeid in ('.GetSonIds($typeid).')'; else $orwheres[] = ' arc.typeid in ('.GetSonIds($typeid).','.$CrossID.')';
替換成以下代碼
//副欄目處理 $vicewheres = ""; $typeids = explode(",",GetSonIds($typeid)); $crossids = explode(",",$CrossID); $typeidss = array_merge($typeids,$crossids); $typeidss = array_unique($typeidss); foreach($typeidss as $tid){ $liketypeid2 = ",".$tid.","; $vicewheres.= " or CONCAT(',',arc.typeid2,',') like '%$liketypeid2%' "; } if($CrossID==''){ if($vicewheres!="") $orwheres[] = ' (arc.typeid in ('.GetSonIds($typeid).') '.$vicewheres.') '; else $orwheres[] = ' arc.typeid in ('.GetSonIds($typeid).') '; }else{ if($vicewheres!="") $orwheres[] = ' (arc.typeid in ('.GetSonIds($typeid).','.$CrossID.') '.$vicewheres.') '; else $orwheres[] = ' arc.typeid in ('.GetSonIds($typeid).','.$CrossID.') '; }
通過以上辦法,可以有效地解決了DEDECMS不支持通過arclist標(biāo)簽調(diào)用副欄目文章的問題。