diff options
Diffstat (limited to 'views/default/output/tagcloud.php')
-rw-r--r-- | views/default/output/tagcloud.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php new file mode 100644 index 000000000..5d219fd07 --- /dev/null +++ b/views/default/output/tagcloud.php @@ -0,0 +1,28 @@ +<?php
+
+ /**
+ * This is a generic view that will display a tag cloud for any
+ * section; photos, services, resources and a user or group
+ **/
+
+ if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
+
+ $counter = 0;
+ $cloud = "";
+ $max = 0;
+ foreach($vars['tagcloud'] as $tag) {
+ if ($tag->total > $max) {
+ $max = $tag->total;
+ }
+ }
+ foreach($vars['tagcloud'] as $tag) {
+ if (!empty($cloud)) $cloud .= ", ";
+ $size = round((log($tag->total) / log($max)) * 100) + 30;
+ if ($size < 60) $size = 60;
+ $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . "&type=".urlencode($tag->tag_type)."\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" .$tag->tag . "</a>";
+ }
+ echo $cloud;
+
+ }
+
+?>
\ No newline at end of file |