|
|
< div id="tagcloud" >
$SQL = "SELECT * FROM yourtable ORDER BY
RAND() LIMIT 25";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$article_tags = $row["article_tags"];
$tag_art = "$article_tags";
$tag_art = str_replace(', ', ',', $tag_art);
$tag_art = str_replace(' ,', ',', $tag_art);
$tag_art = explode(",", $tag_art);
$tag_art = str_replace(' ', '-', $tag_art);
for($i = 1; $i < count($tag_art); $i++){
$tagme = str_replace('-', ' ', $tag_art[$i]);
echo " $tagme ";
}
}
?>
< / div >
Forth, add this to the bottom of your page:
$(document).ready(function() {
$("#tagcloud a").tagcloud({ size: { start: 10, end: 24, unit: 'px' },
color: { start: "#CDE", end: "#FS2"
}
});
});
Check out these links for more information
http://www.jondev.net/articles/jQuery_Tag_Cloud_Example
https://github.com/addywaddy/jquery.tagcloud.js/blob/master/jquery.tagcloud.js
| PHPJqueryJavascriptTag Cloud StyleSimple Tag Cloud StylePHP Tag Cloud |
