Home >CMS Tutorial >DEDECMS >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='$imgid'"); $addtable = trim($row['addtable']); //获取图片附加表imgurls字段内容进行处理 $row = $dsql->GetOne("Select imgurls From `$addtable` where aid='$imgid'"); //调用inc_channel_unit.php中ChannelUnit类 $ChannelUnit = new ChannelUnit(2,$imgid); //调用ChannelUnit类中GetlitImgLinks方法处理缩略图 $lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']); //返回结果 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['dd']; } ?>
Invoking method for arclist and list template code:
[field:ID function='GetTotalArc(@me)'/]
Invoking method of using code in other locations:
[field:ID runphp='yes'] @me = GetTotalArc(@me);[/field:ID]
The screenshot of the effect after running is as follows:
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!