Bernard,
If its a multi dementional array, the $value would be an array itself.
You can try the following:
// Clean up multi-dem array to only pull data as such
function clean_tags($tags) {
$curtags = array();
foreach ($tags as $key => $value) {
// calculate font-size
// find the $value in excess of $min_qty
// multiply by the font-size increment ($size)
// and add the $min_size set above
$size = round($min_size + (($value - $min_qty) * $step));
if (is_array($value)) {
$curtags['land'] = $value['countrycode'];
/* ** other items would be called as such **
$count = $value['zahl'];
$country_name = $value['land'];
$country_code = $value['countrycode'];
*/
} else {
$curtags[$key] = $value;
} // end if
} // end foreach
return $curtags;
}
// call this function before your tags cloud function
It may be something like that... effectively what I am doing there is cleaning up the tags before you call your current function.
You can do it within the printTagCloud funciton as well:
function printTagCloud($tags) {
// $tags is the array
//arsort($tags);
$max_size = 32; // max font size in pixels
$min_size = 12; // min font size in pixels
// largest and smallest array values
$max_qty = max(array_values($tags));
$min_qty = min(array_values($tags));
// find the range of values
$spread = $max_qty - $min_qty;
if ($spread == 0) { // we don't want to divide by zero
$spread = 1;
}
// set the font-size increment
$step = ($max_size - $min_size) / ($spread);
// loop through the tag array
foreach ($tags as $key => $value) {
// calculate font-size
// find the $value in excess of $min_qty
// multiply by the font-size increment ($size)
// and add the $min_size set above
if (is_aray($value) {
$vcount = $value['zahl'];
$country_name = $value['land'];
$country_code = $value['countrycode'];
} else {
$vcount = $value;
$country_name = $key;
//$country_code = $key;
// not sure which one you want...
// from the first array example, its the country name, not code shown.
}
$size = round($min_size + (($vcount - $min_qty) * $step));
echo '<a href="$vcount" style="font-size: ' . $size . 'px">' . $country_name . '</a> ';
// note: you put value code there, but you can use any of the above variables that you wish
// including count, country name, and country code.
// if you want the country code instead of the count, replace $vcount from the href to $country_code
}
}
Of course i just threw this together, so I may very well have made a mistake. I hope this helps you..