Get the App
SLTechnology News&Howtos  ›  Servers  › 

How the dedecms Dream Weaving TAG tag shows how many articles there are in a single tag

Shulou Source: shulou.com Published: 2022-06-02 03:35:19 11月12日 Update

This article mainly introduces how the dedecms Dream Weaving TAG tag shows how many articles a single tag has, which can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

How does the dedecms Dream Weaving TAG tag show how many articles there are in a single tag?

When we design the dream weaving dedecms template, we want to achieve the link and tag name of the tag, while also showing the number of articles associated with each tag.

However, Weaving Dream does not have such a tag to call by default, so we need to modify the system files to achieve it. The specific methods are as follows:

Find and open the / include/taglib/tag.lib.php file and find the following code at line 87 or so:

$row ['link'] = $cfg_cmsurl. "/ tags.php?/" .urlencode ($row [' keyword']). "/"

Add the following code at the bottom of this line:

$count = $dsql- > GetOne ("Select count (tid) From `dede_ taglist`where tag ='". $row ['tag']. "'"); $row ['count'] = $count [' count (tid)']

After you add it, you can use [field:count/] to obtain the number of articles associated with the current tag tag in the tag loop tag of the template. The complete example is as follows:

{dede:tag sort='hot' getall='2'} [field:tag /] {/ dede:tag} Thank you for reading this article carefully. I hope the editor can share the dedecms Dream Weaving TAG tag how to show how many articles in a single tag are helpful to everyone. At the same time, I also hope you can support us, pay attention to the industry information channel, find the problem, and the detailed solution is waiting for you to learn!

Tags: Tags articles individual code simultaneous quantity files articles methods templates associations values content can be passed time friends examples systems ribbons industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology MySQL vpn OPPO Reno