DedeCMS默認在欄目列表頁沒有調用當前欄目內容數量的標簽,但有時候我們做網站時又需要調用這個數量。
下面就告訴大家兩種方法:
第一種方法:修改include/inc_arcpart_view.php文件
找到function ParseTemplet()函數
修改為:
function ParseTemplet() {
if(!is_array($this->dtp->CTags)) return "";
foreach($this->dtp->CTags as $tagid=>$ctag) {
$tagname = $ctag->GetName(); //countclass 統計欄目文章數量
if( $tagname == "countclass" ){
$tid = $ctag->GetAtt("typeid");
$row = $this->dsql->GetOne("Select count(ID) as dd From tufei_archives where typeid='$tid' and arcrank<>-1");
$this->dtp->Assign($tagid,$row['dd']);
}
調用標簽:
{dede:countclass typeid=欄目ID