Simple Tag Cloud Style Jquery PHP » Mike Howey

Simple Tag Cloud Style Jquery PHP
Starting a Dating or MatchMaking Website
 
 So simple pretty tag cloud


 
 
 
 

 
If I were you I would just view the source of this page and look at what I did.

First you need Jquery.
I would guess you have it already on your page.

Second,
get the jquery.tagcloud.js from github or just look at my code and take it.

Third, the PHP.. This is how I do it


Your div should be 

 

< 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

 


add here
 
Please login to add a comment.
Share this Link
Share On Facebook Share On Twitter
Subscribe
Subscribe using Yahoo Subscribe using Delicious Share on Digg Share on Stumbleupon Share on Reddit Share on Tumblr Raw RSS

Simple Tag Cloud Style Jquery PHP » Mike Howey