<?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>';
?>
<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>