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='45' getall='1' sort='hot'} <a href='[field:link/]' 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='35' sort='month'} <a href='[field:link/]' title="[field:tag /]([field:total /])" style="[field:total runphp=yes]@me=getTagStyle();[/field:total]">[field:tag /]</a> {/dede:tag} </div> </li>
2. Add the following function to /include/common.func.php.
The code is as follows:
function getTagStyle() { $minFontSize=8; //最小字体大小,可根据需要自行更改 $maxFontSize=18; //最大字体大小,可根据需要自行更改 return 'font-size:'.($minFontSize+lcg_value()*(abs($maxFontSize-$minFontSize))).'px;color:#'.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255)); }
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('8','9','10','11','12','20'); //自定义字体大小,可根据需要自行修改 return 'font-size:'.$sizearray[rand(0,count($sizearray))].'pt;color:#'.dechex(rand(0,255)).dechex(rand(0,196)).dechex(rand(0,255)); }
3. Generate You can see the effect below!
Finally, let everyone take a look at the renderings: Renderings
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
