Home  >  Article  >  CMS Tutorial  >  How to add the number of statistical documents in the column list of dedecms dreamweaver template

How to add the number of statistical documents in the column list of dedecms dreamweaver template

藏色散人
藏色散人Original
2019-12-09 09:30:361815browse

How to add the number of statistical documents in the column list of dedecms dreamweaver template

How to add the number of statistical documents to the column list of dedecms Dreamweaver template?

dedecms Add the statistical document number calling tag to the column list. The implementation method is still very simple. We only need to make some simple modifications to achieve the functions we need.

Recommended learning: Dreamweaver cms

The method is as follows:

Open the include/extend.func.php file and add it above the last line? The following content:

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'];   }

The following is the sample code I added for your reference!

<?php
function litimgurls($imgid=0){
   global $lit_imglist;
   $dsql = new DedeSql(false);
   //获取附加表
   $row = $dsql->GetOne("SELECT c.addtable FROM dede_archives AS a LEFT JOIN dede_channeltype AS c ON a.channel=c.id where a.id=&#39;$imgid&#39;");
   $addtable = trim($row[&#39;addtable&#39;]);
   //获取图片附加表imgurls字段内容进行处理
   $row = $dsql->GetOne("Select imgurls From `$addtable` where aid=&#39;$imgid&#39;");
   //调用inc_channel_unit.php中ChannelUnit类
   $ChannelUnit = new ChannelUnit(2,$imgid);
   //调用ChannelUnit类中GetlitImgLinks方法处理缩略图
   $lit_imglist = $ChannelUnit->GetlitImgLinks($row[&#39;imgurls&#39;]);
   //返回结果
   return $lit_imglist;
}
 
// 文档数量调用标签
 
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[&#39;dd&#39;];   
}   
?>

Invoking method for arclist and list template code:

[field:ID function=&#39;GetTotalArc(@me)&#39;/]

Invoking method of using code in other locations:

[field:ID runphp=&#39;yes&#39;] @me = GetTotalArc(@me);[/field:ID]

The screenshot of the effect after running is as follows:

How to add the number of statistical documents in the column list of dedecms dreamweaver template

The above is the detailed content of How to add the number of statistical documents in the column list of dedecms dreamweaver template. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn