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 | |
parent | 388c1da05d08d890cb644bcce967e7ecae8bad3d (diff) | |
download | fourisland-ea0a51e354a409146f164af0f25b92262bfc93af.tar.gz fourisland-ea0a51e354a409146f164af0f25b92262bfc93af.tar.bz2 fourisland-ea0a51e354a409146f164af0f25b92262bfc93af.zip |
Added a tag cloud
-rwxr-xr-x | includes/footer.php | 27 | ||||
-rwxr-xr-x | theme/footer.tpl | 16 |
2 files changed, 43 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'])); |
diff --git a/theme/footer.tpl b/theme/footer.tpl index ed4e94d..b5f49c1 100755 --- a/theme/footer.tpl +++ b/theme/footer.tpl | |||
@@ -175,6 +175,22 @@ | |||
175 | <DIV CLASS="bubble"> | 175 | <DIV CLASS="bubble"> |
176 | <DIV CLASS="rounded"> | 176 | <DIV CLASS="rounded"> |
177 | <BLOCKQUOTE> | 177 | <BLOCKQUOTE> |
178 | <DIV ID="hatbar"><H3>Tag Cloud</H3><P> | ||
179 | <P> | ||
180 | <!--BEGIN TAGCLOUD--> | ||
181 | <A HREF="/blog/tag/<!--TAGCLOUD.TAG-->.php" STYLE="font-size: <!--TAGCLOUD.SIZE-->pt"><!--TAGCLOUD.TAG--></A> | ||
182 | <!--END TAGCLOUD--> | ||
183 | </P> | ||
184 | </DIV> | ||
185 | </BLOCKQUOTE> | ||
186 | </DIV> | ||
187 | </DIV> | ||
188 | </DIV> | ||
189 | |||
190 | <DIV class="sidebar"> | ||
191 | <DIV CLASS="bubble"> | ||
192 | <DIV CLASS="rounded"> | ||
193 | <BLOCKQUOTE> | ||
178 | <DIV ID="hatbar"> | 194 | <DIV ID="hatbar"> |
179 | <H3>Recent Comments</H3> | 195 | <H3>Recent Comments</H3> |
180 | 196 | ||