Home > CMS Tutorial > DEDECMS > How does dedecms dreamweaver TAG tag display how many articles there are in a single tag?

How does dedecms dreamweaver TAG tag display how many articles there are in a single tag?

藏色散人
Release: 2020-10-21 10:29:48
Original
2112 people have browsed it

How does dedecms dreamweaver TAG tag display how many articles there are in a single tag?

dedecms织梦TAG标签怎么显示单个标签共有多少篇文章?

我们在进行织梦dedecms模板设计的时候,想实现tag的链接和tag名的同时,还能显示每个tag关联的文章的数量。

推荐学习:织梦cms

但是织梦默认没有这样的标签来调用,这就需要我们自己对系统文件进行修改来实现了,具体方法如下:

找到并打开/include/taglib/tag.lib.php这个文件,找到第87行左右的下面这句代码:

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

在这行代码的下面添加如下代码:

$count = $dsql->GetOne("Select count(tid) From `dede_taglist` where tag = '".$row['tag']."'");
$row['count'] = $count['count(tid)'];
Copy after login

添加好后在模板的tag循环标签里面就可以通过[field:count/]来获取当前tag标签关联的文章数量了,完整示例如下:

{dede:tag sort='hot' getall='2'}
 <ul><li>
 <a title="[field:count/]个话题" href="[field:link/]">[field:tag /]</a>
 </li>
 </ul>
{/dede:tag}
Copy after login

The above is the detailed content of How does dedecms dreamweaver TAG tag display how many articles there are in a single tag?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template