DEDECMS Add statistical documents to the column list call label
Source: Internet
Author: User
Keywordstags dedecms number of documents column list
Dedecms in the list of columns to add statistics to the number of documents call tag, the implementation of the method is very simple, only need to make some simple changes to achieve the functionality we need.
The method is as follows:
Open the include/extend.func.php file and add the following on the last line:
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 '];&http://www.aliyun.com/zixun/aggregation/37954.html ' >nbsp; }
The following is the sample code I added for your reference!
<?php function Litimgurls ($imgid =0) { Global $lit _imglist; $dsql = new Dedesql (false); Get additional tables $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 ']); Get Picture attached table imgurls field content to process $row = $dsql->getone ("Select Imgurls from ' $addtable ' where aid= ' $imgid '"); Call Channelunit class in inc_channel_unit.php $ChannelUnit = new Channelunit (2, $imgid); Call the Getlitimglinks method in the Channelunit class to process the thumbnail $lit _imglist = $ChannelUnit->getlitimglinks ($row [' imgurls ']); return results return $lit _imglist; }
Number of documents call label
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 ']; } ?>
Call method for Arclist and list template code:
[Field:id function= ' Gettotalarc (@me) '/]
Calling methods for using code in other locations:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.