<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

织梦调用tag标签对应文章数量的方法

时间:2020-12-21

有些时候我们想实现类似于wordpress博客那样的tag标签,就是在显示tag的链接和tag名的同时,还能显示每个tag关联的文章的数量。

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

找到并打开/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:tagsort='hot'getall='2'} <li><atitle="[field:count/]个话题"href="[field:link/]">[field:tag /]</a></li> {/dede:tag}

getall:获取类型。参数有:0和1,其中0为当前内容页或栏目页tag,1为获取全站tag
0
首页
案例
关于
联系