PHP creates a tag cloud function that generates a series of link effects, and varies in size and looks interesting.
01
02function Getcloud ($data = Array (), $minFontSize = A, $maxFontSize = 30)
03{
04$minimumcount = Min (array_values ($data));
05$maximumcount = Max (Array_values ($data));
06$spread = $maximumCount-$minimumCount;
07$cloudhtml = ";
08$cloudtags = Array ();
09$spread = = 0 && $spread = 1;
10foreach ($data as $tag = $count)
11{
12$size = $minFontSize + ($count-$minimumCount)
13* ($maxFontSize-$minFontSize)/$spread;
14$cloudtags[] = '
+ ' returned a count of '. $count. ' > '
Htmlspecialchars (Stripslashes ($tag)). '';
18}
19return join ("\ n", $cloudTags). "\ n";
20}
21?>
Invocation Example:
View Sourceprint?
1
2$arr = Array (' codefans ' = +, ' Adobe ' +, ' Background ' = 43,
3 ' Blur ' +, ' Canvas ', ' + ', ' Class ' and ', ' Design ' and ' 8, ' Encode ' and ' 30 ', ' encryption ',
4 ' Extract ', ' Filters ' + 42);
5echo Getcloud ($arr, 12, 36);
6?>
http://www.bkjia.com/PHPjc/765430.html www.bkjia.com true http://www.bkjia.com/PHPjc/765430.html techarticle PHP creates a tag cloud function that generates a series of link effects, and varies in size and looks interesting. PHP 02function getcloud ($data = Array (), $minFontSize = $maxFontSize ...