織夢dede:channelartlist調用排除指定typeid欄目


在使用 dede:channelartlist 自動調用欄目內容時,經常會遇到某些欄目不需要調用,比如“關於我們”、“聯系地址”等無持續更新的欄目。要想在 dede:channelartlist 調用時排出某些欄目,這需要修改dede源碼,讓 dede:channelartlist 排除指定typeid。

打開 \include\taglib\channelartlist.lib.php 文件
找到

$attlist = 'typeid|0,row|20,cacheid|'; 

修改為:

// 此處添加了一個所要排除typeid的參數—notypeid $attlist = 'typeid|0,row|20,cacheid|,notypeid|0'; 

找到

$dsql>SetQuery("Selectid,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 ='7' notypeid='8'} 

其中notypeid=’8′ 中的 8 為 7 的子欄目即生效。
當然notypeid和typeid也可以分開各自使用.





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM