Home > Article > CMS Tutorial > 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'])."/";
在这行代码的下面添加如下代码:
$count = $dsql->GetOne("Select count(tid) From `dede_taglist` where tag = '".$row['tag']."'"); $row['count'] = $count['count(tid)'];
添加好后在模板的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}
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!