diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 21:37:00 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 21:37:00 -0500 |
commit | ea0a51e354a409146f164af0f25b92262bfc93af (patch) | |
tree | b091dd1aeb00cafb1db5343f8876db230a690ead /includes | |
parent | 388c1da05d08d890cb644bcce967e7ecae8bad3d (diff) | |
download | fourisland-ea0a51e354a409146f164af0f25b92262bfc93af.tar.gz fourisland-ea0a51e354a409146f164af0f25b92262bfc93af.tar.bz2 fourisland-ea0a51e354a409146f164af0f25b92262bfc93af.zip |
Added a tag cloud
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/footer.php | 27 |
1 files changed, 27 insertions, 0 deletions
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)) | |||
205 | 'POST' => $getpost3[$i]['post_id'], | 205 | 'POST' => $getpost3[$i]['post_id'], |
206 | 'USERNAME' => $getuser3['username'])); | 206 | 'USERNAME' => $getuser3['username'])); |
207 | } | 207 | } |
208 | |||
209 | $gettags = "SELECT DISTINCT tag FROM tags"; | ||
210 | $gettags2 = mysql_query($gettags); | ||
211 | $i=0; | ||
212 | while ($gettags3[$i] = mysql_fetch_array($gettags2)) | ||
213 | { | ||
214 | $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\""; | ||
215 | $cnttag2 = mysql_query($cnttag); | ||
216 | $cnttag3 = mysql_fetch_array($cnttag2); | ||
217 | |||
218 | $counts[$gettags3[$i]['tag']] = $cnttag3[0]; | ||
219 | |||
220 | $i++; | ||
221 | } | ||
222 | |||
223 | $min_count = min($counts); | ||
224 | $spread = max($counts) - $min_count; | ||
225 | $spread = ($spread <= 0) ? 1 : $spread; | ||
226 | $font_step = 8 / $spread; | ||
227 | |||
228 | uksort($counts, 'strnatcasecmp'); | ||
229 | |||
230 | foreach ($counts as $tag => $count) | ||
231 | { | ||
232 | $template->adds_block('TAGCLOUD', array( 'TAG' => $tag, | ||
233 | 'SIZE' => (8 + (($count - $min_count) * $font_step)))); | ||
234 | } | ||
208 | } | 235 | } |
209 | 236 | ||
210 | $template->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); | 237 | $template->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); |