演示地址:https://www.tuyuanma.com/tag.html
找到标签显示页,修改更换如下代码- <!--{eval $mtags = DB::fetch_all("SELECT a.tagid, a.tagname, count(b.tagid) as tag_count FROM ".DB::table("common_tag")." a LEFT JOIN ".DB::table("common_tagitem")." b on b.tagid=a.tagid WHERE a.`status` = 0 group by b.tagid ORDER BY a.`tagid` DESC LIMIT 0,480");}-->
- <div class="fmtags">
- <!--{loop $mtags $mtag}-->
- <!--{if $mtag[tag_count]>0}-->
- <a href="misc.php?mod=tag&id=$mtag[tagid]" target="_blank" class="xi2">$mtag[tagname]{$mtag[tag_count]}</a>
- <!--{/if}-->
- <!--{/loop}-->
- </div>
复制代码 其中DESC为按升序排序,如需按降序排序,则修改为ASC即可
按标签相关帖子数排序代码- <!--{eval $mtags = DB::fetch_all("SELECT a.tagid, a.tagname, count(b.tagid) as tag_count FROM ".DB::table("common_tag")." a LEFT JOIN ".DB::table("common_tagitem")." b on b.tagid=a.tagid WHERE a.`status` = 0 group by b.tagid ORDER BY `tag_count` DESC LIMIT 0,480");}-->
- <div class="fmtags">
- <!--{loop $mtags $mtag}-->
- <!--{if $mtag[tag_count]>0}-->
- <a href="misc.php?mod=tag&id=$mtag[tagid]" target="_blank" class="xi2">$mtag[tagname]{$mtag[tag_count]}</a>
- <!--{/if}-->
- <!--{/loop}-->
- </div>
复制代码 简单描述:
查询tag的两个表common_tag和common_tagitem,获取tagid,tagname两个字段,并统计tagid个数,分组合计,按tagid倒序排序,取前480条
相关教程:
【实测】discuz修改标签列表页面显示标签的数量,标签数量,标签显示数量
【实测】教你修改DZ论坛帖子的标签数量,默认为5个修改为15个
【实测】修改Discuz搜索显示数,搜索数,搜索展示数
【原创】结合门户tag标签功能,将搜索链接修改为伪静态链接
【实测】Discuz!X3.1标签伪静态 Discuz!X3.0标签伪静态修改和伪静态规则(完整有用)
|