Table of Contents
热门标签
Home CMS Tutorial DEDECMS How to generate tag tags in dede tag cloud

How to generate tag tags in dede tag cloud

Dec 20, 2019 am 10:16 AM
dede

How to generate tag tags in dede tag cloud

How does dede tag cloud generate tags?

How does dede tag cloud generate different colors and different Tag tags of different sizes

tag tag Friends who make websites must know it. In this article, I will explain to you the use of dede tag cloud and how to generate tag tags of different colors and sizes. Interested friends can refer to the following

Recommended learning: 梦Weavercms

1. Select the template of the page you want to add, usually add the following to the homepage index.htm Code

The code is as follows:

<!-- /下面开始tag标签云 --> 
<div> 
<dl class="tbox light"> <dt><strong>Tags标签云</strong></dt> 
<dd>{dede:tag row=&#39;45&#39; getall=&#39;1&#39; sort=&#39;hot&#39;} 
<a href=&#39;[field:link/]&#39; title="[field:tag /]([field:total /])" style="[field:total runphp=yes]@me=getTagStyle();[/field:total]">[field:tag /]</a> 
{/dede:tag} 
</dd> 
</dl> 
</div> 
<!-- /tag标签云结束 --> 
***或(测试通过)*** 
<li> 
<div class="s_title"><h2 id="热门标签">热门标签</h2></div> 
<div class="tagnews"> 
{dede:tag row=&#39;35&#39; sort=&#39;month&#39;} 
<a href=&#39;[field:link/]&#39; title="[field:tag /]([field:total /])" style="[field:total runphp=yes]@me=getTagStyle();[/field:total]">[field:tag /]</a> 
{/dede:tag} 
</div> 
</li>
Copy after login

2. Add the following function to /include/common.func.php.

The code is as follows:

function getTagStyle() 
{ 
$minFontSize=8; //最小字体大小,可根据需要自行更改 
$maxFontSize=18; //最大字体大小,可根据需要自行更改 
return &#39;font-size:&#39;.($minFontSize+lcg_value()*(abs($maxFontSize-$minFontSize))).&#39;px;color:#&#39;.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255)); 
}
Copy after login

The function of this function is to output a random style, including font-size and color.

If you want to specify only a few font sizes to be displayed instead of completely random, please modify the above function code to:

The code is as follows:

function getTagStyle() 
{ 
$sizearray = array(&#39;8&#39;,&#39;9&#39;,&#39;10&#39;,&#39;11&#39;,&#39;12&#39;,&#39;20&#39;); //自定义字体大小,可根据需要自行修改 
return &#39;font-size:&#39;.$sizearray[rand(0,count($sizearray))].&#39;pt;color:#&#39;.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255)); 
}
Copy after login

3. Generate You can see the effect below!

Finally, let everyone take a look at the renderings: Renderings

How to generate tag tags in dede tag cloud

The above is the detailed content of How to generate tag tags in dede tag cloud. For more information, please follow other related articles on the PHP Chinese website!

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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)