towards a tag cloud

So I wanted to include a tag cloud in the tweet nest page, the fastest was was building on top of this. Then I compiled a file to use with index page, here is the file and use the following command in the index.php in your tweetnest folder.

require “inc/preheader.php”;


$connection = mysql_connect("localhost", "root", "pass");
    $query="SELECT `word`,`tweets`,null FROM `tn_words` where word<>'The' and word<>'are' and word<>'for' and  word<>'and' and word<>'that' and word<>'http' and word<>'you' and word<>'this' and word<>'with' order by tweets desc limit 100;";
// Incresing this number will make the words bigger; Decreasing will do reverse
$factor = 15;
// Smallest font size possible
$starting_font_size = 1;
// Tag Separator
$tag_separator = '&nbsp; &nbsp; &nbsp;';
$max_count = array_sum($words);
 foreach($words as $tag => $weight )
    $x = round(($weight * 100) / $max_count) * $factor;
    $font_size = $starting_font_size + $x.'px';
    if($words_link[$tag]=='NA') echo "<span style='font-size: ".$font_size."; color: #676F9D;'><a href='".$tag."&meta='>".$tag."</a></span>".$tag_separator;
    else echo "<span style='font-size: ".$font_size."; color: #676F9D;'><a href='http://".$words_link[$tag]."/'>".$tag."</a></span>".$tag_separator;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s