我知道织梦DEDECMS的后台,可以统计出网站的文章数量信息,但是不能显示每个栏目的文章统计信息,

以下是两种可以实现栏目文章统计信息的方法,提供给大家学习研究。

第一种方法:
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 统计栏目文章数量
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=栏目编号/}
例如:
{dede:countclass typeid='2'/}
第二种方法(由 正牌执子之手339709 提供):
1、修改include/inc_functions.php文件,增加函数如下:
function GetTotalArc($tid){
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select count(ID) as dd From dede_archives where typeid='$tid'");
return $row['dd'];
}
2、调用方法
[field:id function='GetTotalArc(@me)'/]

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。