background image

    $cloud_tags = array(); // create an array to hold tag code
    foreach ($tags as $tag => $count) {
        $size = $min_size + ($count - $minimum_count) 
            * ($max_size - $min_size) / $spread;
        $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' 
            . '" class="tag_cloud" target="_blank" href="http://www.jbxue.com/index.php?s=' . $tag 
            . '" title="\'' . $tag  . '\' returned a count of ' . $count . '">' 
            . htmlspecialchars(stripslashes($tag)) . '</a>';
    }
    $cloud_html = join("\n", $cloud_tags) . "\n";
    return $cloud_html;
}
?>

2,css 样式表
代码示例

:

<style type="text/css">
.tag_cloud
 {padding: 3px; text-decoration: none;
 font-family: verdana;  }
.tag_cloud:link  { color: #FF66CC; }
.tag_cloud:visited { color: #9900FF; }
.tag_cloud:hover { color: #FF66CC; background: #000000; }
.tag_cloud:active { color: #6699FF; background: #000000; }
</style>
3,显示标签云的区域
代码示例

:

<div id="wrapper">
 <?php print tag_cloud(); ?>
</div>