织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

实现DedeCms栏目文章统计功能

织梦园模板 / 2021-02-04 / 收藏

很多站长都想要网站有栏目文章统计功能,特意为大家搜集整理了两种方法来实现这个功能,方法如下:

 

***种方法:

 

1、修改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']);  

 

2、网页调用方法

 

{dede:countclass typeid=栏目ID/}

 

例如:

 

{dede:countclass typeid='2′/}

 

第二种方法:

 

1、修改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']; }

 

2、调用方法

 

[field:ID runphp='yes'] @me = GetTotalArc(@me);[/field:ID]

相关织梦技巧

收缩