aboutsummaryrefslogtreecommitdiff
path: root/views/default/output/tagcloud.php
blob: 5d219fd0718e6e595d3d0614c01bac22ab5880de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;

    }
     
?>