In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how DEDECMS obtains the number of articles in the current column and all sub-columns. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
How does DEDECMS get the number of articles in the current column and all sub-columns?
The following code is used to query the total number of articles in the current column and all subcolumns under the current column, adding to / include/common.func.php
Or / include/extend.func.php, and then call getTotalArcByTid (1) in the template.
The code is as follows:
/ * * return the number of articles matching the record * @ description DEDE does not allow subquery to solve the problem of article statistics under the column * @ param $level query all subcategories * * / function getTotalArcByTid ($tid, $level=TRUE) {global $dsql; $level==TRUE & & $tid = GetSonTypeID ($tid); $sql = "SELECT count (id) as total from `dede_ Archives`where typeid in ($tid)"; $result = $dsql- > GetOne ($sql); return $result ['total'] } / * * Recursively get eligible subcolumns * @ param $tid column ID * @ return string * * / function GetSonTypeID ($tid) {global $dsql; $dsql- > SetQuery ("Select id From `dede_ arctype` where reid in ($tid) And ishidden1 order by sortrank"); $dsql- > Execute ($tid); $typeid =''; while ($row=$dsql- > GetObject ($tid)) {$typeid. = "{$row- > id},"; $typeid. = GetSonTypeID ($row- > id);} return trim ($typeid,',');}
Call method:
The methods called in the template are generally:
{dede:field.typeid function= "getTotalArcByTid (@ me)" /}
Or
[field:typeid function= "getTotalArcByTid (@ me)" /] the number of articles about how DEDECMS gets the current column and all its sub-columns is shared here. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.