Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Dream weaving dedecms calls the method of the number of articles in the current column

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about the method of dream weaving dedecms calling the number of articles in the current column. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

How does dream weaving dedecms call the number of articles in the current column?

Dream weaving dedecms calls the number of articles in the current column

When making a template, it is often necessary to add the number of articles for each column. Share with you the implementation method, this method is suitable for 5.6and 5.7, 5.7sp1 other untested

Steps / methods

Modify the include/common.func.php file and add the following code at the end:

/ / function GetTotalArc ($tid) {global $dsql;$sql = GetSonIds ($tid); $row = $dsql- > GetOne ("Select count (id) as dd From zmb_archives where typeid in ({$sql})"); return $row ['dd'];} / Statistics current column information function dynamic_num ($current_id) {global $dsql; / / read the current column's sub-ID $sql = "SELECT id FROM zmb_arctype WHERE id='$current_id' | | topid='$current_id'"; $dsql- > SetQuery ($sql) $dsql- > Execute (); while ($row = $dsql- > GetArray ()) {$arr [] = $row [id];} foreach ($arr as $key= > $value) {$type. = $value. ',';} $ty= ". $type." 0 "; / / echo $ty; $t_num = $dsql- > GetOne (" select count (*) as num from zmb_archives where typeid in ($ty) "); / / echo $tnum [num]; if (is_array ($t_num)) {return". $tnum. ";} else {return" 0 ";}}

The calling code in the template:

(this class has {dede:type} [field:id function= "dynamic_num (@ me)" /] {/ dede:type}

Documents)

And

[field:id runphp='yes'] @ me = GetTotalArc (@ me); [/ field:id]

For example:

{dede:field name='typename'/} (this class has {dede:type} [field:id function= "dynamic_num (@ me)" /] {/ dede:type} documents) {dede:channel type='son'} [field:typename/] ([field:ID runphp='yes'] @ me= GetTotalArc (@ me); [/ field:ID]) {/ dede:channel} Thank you for reading! About weaving dream dedecms calls the current column article number method to share here, I hope the above content can have some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report