教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php Flash标签云(flash tagcloud)的实现代码

php Flash标签云(flash tagcloud)的实现代码

发布时间:2016-10-29   编辑:jiaochengji.com
本文介绍下,php实现的flash标签云的一例代码,有需要的朋友参考下。

php实现的一段3D球形标签云(tagcloud)的代码,可支持中文,并随意放在自己的博客或网站的任意地方。
说明:以下代码源于wp的一个插件,经修改完善而来。

核心代码:
 

复制代码 代码示例:
<?php
require("config.php");
require_once 'Tags.php';   
$sql = "SELECT tags FROM demo";  //在这里你可以随机或者限制一下取出的个数. 
$rs = $db->query($sql);
while ($tags = $db->fetch_array($rs)) {
     $arr[] = split("\|",iconv("gb2312","utf-8",$tags['tags']));
}
$tags = new Tags($arr);
$tagsArr = $tags->getTags();
$tagsStr = '<tags>'; 
foreach ($tagsArr as $value){
     $tagsStr .= urlencode('<a href="testtags.php?action='.urlencode($value).'" style="font-size:'.rand(8,24).'pt;">'.$value.'</a>');
}
$tagsStr .= '</tags>';
?>

js代码部分:
 

复制代码 代码示例:
<script type="text/javascript">
    var rnumber = Math.floor(Math.random()*9999999); 
    var cloud = new SWFObject("Tags/tagcloud.swf?r="+rnumber, "tagcloudflash", "250", "250", "9", "#ffffff"); 
    cloud.addParam("wmode", "transparent"); 
    cloud.addParam("allowScriptAccess", "always"); 
    cloud.addVariable("tspeed", "120"); 
    cloud.addVariable("mode", "tags"); 
    cloud.addVariable("tagcloud", '<?=$tagsStr?>'); 
    cloud.write("Tags"); 
</script>

您可能感兴趣的文章:
php Flash标签云(flash tagcloud)的实现代码
php 云标签的实现代码
cnblogs TagCloud基于jquery的实现代码
分享二个php 标签云的实例代码
含有Flash的网页如何通过校验?
php mysql实现标签云的实例代码
使用PHP 快速生成Flash 动画
神奇的7个jQuery 3D插件整理
php 云标签的简单范例
html5是什么?html5的介绍以及优缺点总结

[关闭]
~ ~