From ea0a51e354a409146f164af0f25b92262bfc93af Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 7 Dec 2008 21:37:00 -0500 Subject: Added a tag cloud --- includes/footer.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'includes') diff --git a/includes/footer.php b/includes/footer.php index 204aaf5..b400bbb 100755 --- a/includes/footer.php +++ b/includes/footer.php @@ -205,6 +205,33 @@ if (!isset($noRightbar)) 'POST' => $getpost3[$i]['post_id'], 'USERNAME' => $getuser3['username'])); } + + $gettags = "SELECT DISTINCT tag FROM tags"; + $gettags2 = mysql_query($gettags); + $i=0; + while ($gettags3[$i] = mysql_fetch_array($gettags2)) + { + $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\""; + $cnttag2 = mysql_query($cnttag); + $cnttag3 = mysql_fetch_array($cnttag2); + + $counts[$gettags3[$i]['tag']] = $cnttag3[0]; + + $i++; + } + + $min_count = min($counts); + $spread = max($counts) - $min_count; + $spread = ($spread <= 0) ? 1 : $spread; + $font_step = 8 / $spread; + + uksort($counts, 'strnatcasecmp'); + + foreach ($counts as $tag => $count) + { + $template->adds_block('TAGCLOUD', array( 'TAG' => $tag, + 'SIZE' => (8 + (($count - $min_count) * $font_step)))); + } } $template->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); -- cgit 1.4.1