July 15, 2008

为simple-tags添加多彩标签云

      一直有人羡慕我侧边栏上彩色标签云(colorful tags cloud), 问我是用什么方法, 我也一直够懒, 只在评论中对需要者进行相应的回复。 这次我就把这个修改的方法直接写成一个日志, 也免得我一而再、再而三的回答了。

      (另外吗, 主要也是我好久没有写博客日志了, EstyleDickey等大部分的同学都等着我更新, 最近实在太忙, 忙得我没有闲来的心来写个日志, 请各位见谅了, 这篇日志也就当是好久没有日志的滥竽充数了)

      言归正传, 首先我的修改是针对 simple tags 这个插件的, 其他的我就不说了, 你可以参照这里的方法自己研究。

      1、在simple-tags.client.php文件中查找该语句

function getColorByScale($scale_color, $min_color, $max_color)

      2、注释掉上述函数中的以下语句(其实不注释掉也是无所谓的)

$scale_color = $scale_color / 100;

$minr = hexdec(substr($min_color, 1, 2));

$ming = hexdec(substr($min_color, 3, 2));

$minb = hexdec(substr($min_color, 5, 2));

$maxr = hexdec(substr($max_color, 1, 2));

$maxg = hexdec(substr($max_color, 3, 2));

$maxb = hexdec(substr($max_color, 5, 2));

$r = dechex(intval((($maxr - $minr) * $scale_color) + $minr));

$g = dechex(intval((($maxg - $ming) * $scale_color) + $ming));

$b = dechex(intval((($maxb - $minb) * $scale_color) + $minb));

      3、 在上述被注释掉的语句后增加如下语句(如果没有注释掉就必须加在后面, 否则无效)

//mod by hongfengye start

$r = dechex(rand(0,255));

$g = dechex(rand(0,196));

$b = dechex(rand(0,255));

//mod by hongfengye end

      是的, 就是这么简单, 现在你应该就可以发现你的标签云(tags cloud)已经是彩色(colorful)的了。 效果图如下:

tags cloud

  您喜欢本文吗?即刻订阅"偶爱偶家",精彩文章不再错过!现在就给我们留个话吗?

 

« 慎做俯卧撑 收到第三笔捐赠 »

Related Posts

  • this post have no related
9 responses to "为simple-tags添加多彩标签云"
alex said:
2008年07月15日

添加成功,谢谢!~
http://www.hialex.net/tags

[Reply]

motta said:
2008年07月15日

每次升级simple tags都要去翻你给我的那封邮件, 感谢枫叶啊! ~~~哈哈

[Reply]

abbie said:
2008年07月16日

谢谢枫叶~~~终于有新文章啦~还是那么实用的^ ^
谢谢哈~

[Reply]

jogocun said:
2008年07月16日

我都用不了这个插件奇怪~

[Reply]

robay said:
2008年07月16日

呵呵,先支持一下。虽然不太想用!

[Reply]

imzoo said:
2008年07月20日

谢谢了 马上试试

[Reply]

2008年07月21日

我 试试
谢谢分享

[Reply]

dickym said:
2008年08月01日

改了以后出现
Cannot modify header information - headers already sent by (output started at /home edudou/public_html/wp-content/plugins/simple-tags/2.5/simple-tags.client.php:4286)

[Reply]

winbye said:
2008年10月13日

我改了 为什么还没有改变颜色阿?

我博客刚刚开 随便添加了4个标签

[Reply]

Leave a comment