Próbuje sobie wyświetlić chmurkę tagów, przy pomocy znaalezionej w necie funkcji:
<?php function printTagCloud2($tags) { // $tags is the array $max_size = 32; // max font size in pixels $min_size = 12; // min font size in pixels // largest and smallest array values // 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 echo '<a href="#" style="font-size: ' . $size . 'px" title="' . $value . ' things tagged with ' . $key . '">' . $key . '</a> '; } }
Tagi mam w bazie, wyciągając je:
(...) $title = $row1[title]; $counter = $row1[counter]; } (...)
no i próbuje:
printTagCloud2($tags);
no i lipa.
Mam problem z tą tablicą:
powinna mieć formę
$tags = array('weddings' => 32, 'birthdays' => 41, 'landscapes' => 62, 'ham' => 51, 'chicken' => 23, 'food' => 91, 'turkey' => 47, 'windows' => 82, 'apple' => 27);
a to moje "pobranie" daje:
( ( [aktorka] => 21 ) ( [film] => 1 ) ( [kino] => 1 ) ( [seriale] => 5 ) ( [widoki] => 3 ) ( [zabawne] => 4 ) )
Nie za bardzo łapię tą tablice... Może ktoś podpowie...?
Dzieki za help...