search
HomeCMS TutorialDEDECMSHow 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?

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.