All pastes #142379 Raw Edit

Miscellany

public php v1 · immutable
#142379 ·published 2006-08-21 12:37 UTC
rendered paste body
function tagcloud($taglist, $num = "") {         arsort($taglist); // sort by number of tag instances        if ($num) array_splice($taglist, $num); // keep the top $num - kill the rest        ksort($taglist); // sort by tag name alphabetically        $max = max($taglist);                foreach ($taglist as $tag => $number) {                echo "<span style=\"font-size:";                echo 100+ceil((($number-min($taglist)) / ($max-min($taglist))) * 10)*10;                echo "%\"><a href=\"tag/" . $tag . "\" title=\"$number people have tagged this\">$tag</a></span>\n";                }        echo "\n";        }