All pastes #142311 Raw Edit

Miscellany

public php v1 · immutable
#142311 ·published 2006-08-21 12:09 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:";		switch(TRUE) {						case ( $number == min($taglist) ):				echo 100;				break;						case ( $number == $max ):							echo 200;				break;						case ( $number >= ($max / 10) * 9 ):				echo 190;				break;						case ( $number >= ($max / 10) * 8 ):				echo 180;				break;						case ( $number >= ($max / 10) * 7 ):				echo 170;				break;						case ( $number >= ($max / 10) * 6 ):				echo 160;				break;						case ( $number >= ($max / 10) * 5 ):				echo 150;				break;						case ( $number >= ($max / 10) * 4 ):				echo 140;				break;						case ( $number >= ($max / 10) * 3 ):				echo 130;				break;						case ( $number >= ($max / 10) * 2 ):				echo 120;				break;						default:				echo 110;				break;		}				echo "%\"><a href=\"tag/" . $tag . "\" title=\"$number people have tagged this\">$tag</a></span>\n";		}		echo "\n";	}