很多站长都想要网站有栏目文章统计功能,特意为大家搜集整理了两种方法来实现这个功能,方法如下:
修改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 www.genban.org统计栏目文章数量if( $tagname == "countclass" ){$tid = $ctag->GetAtt("typeid");$row = $this->dsql->GetOne("Select count(ID) as dd From dede_archives where typeid='$tid' and arcrank<>-1");$this->dtp->Assign($tagid,$row['dd']);}
网页调用方法:{dede:countclass typeid=栏目ID/}。例如:{dede:countclass typeid='2′/}修改include/inc_functions.php文件,增加函数如下:function GetTotalArc($tid){global $dsql;$sql = GetSonIds($tid);$row = $dsql->GetOne("Select count(id) as dd From dede_archives where typeid in({$sql})");return $row['dd']; };调用方法:[field:ID runphp='yes'] @me = GetTotalArc(@me);[/field:ID]