Its late Im tired and I can’t seem to get started on a simple task.
Want to create a Word cloud but with more exacting data from database.
I update words on the table based on search count.
Term1 = 22 times
Term2 = 55 times
So the database is laid out very simply
ID term Count
I found a really clean function but I need to modify it and frankly arrays always have given me a bit of a headache.
[php]
function tagination( $baseURL, $tags, $cloud=true ) {
$tagination = ‘’;
if ( $cloud ) {
$minSize = 1; $maxSize = 10;
$maxTotal = max(array_values($tags));
$minTotal = min(array_values($tags));
$range = $maxTotal - $minTotal;
foreach ( $tags as $tagName => $tagTotal ) {
$fontSize = round($minSize + (($tagTotal - $minTotal) *
(($maxSize - $minSize) / $range)));
$tagTotal = number_format($tagTotal);
$tagURL = str_replace(’ ‘, ‘-’, $tagName);
$tagination .= “<a href=”{$baseURL}{$tagURL}" title="{$tagTotal}".
“articles” class=“size{$fontSize}”>{$tagName}\n";
} return $tagination;
} sort($tags);
foreach ( $tags as $tagName ) {
$tagURL = str_replace(’ ', ‘-’, $tagName);
$tagination .= “<a href=”{$baseURL}{$tagURL}" ".
"class=“tag”>{$tagName}, ";
} return substr($tagination, 0, strlen($tagination) - 2);
}
[/php]
[hr]
The CSS code to make it look right
body {font:62.5% arial, helvetica, sans-serif; font-style:normal}
div.cloud {text-align:justify; line-height:3em}
a.size1 {font-size:1.1em}
a.size2 {font-size:1.3em}
a.size3 {font-size:1.5em}
a.size4 {font-size:1.7em}
a.size5 {font-size:1.9em}
a.size6 {font-size:2.1em}
a.size7 {font-size:2.3em}
a.size8 {font-size:2.5em}
a.size9 {font-size:2.7em}
a.size10 {font-size:2.9em}
All the word cloud scripts have me counting an array when I am just going to pull the top 30 or so words based on count DESC LIMIT 0,30
What would be a simple