Poniżej wkleiłem skrypt, który znalazłem na necie. Skrypt ma tworzyć chmurę lecz nie działa. Jeżeli dodaję ręcznie rekord do mysql to wpis pojawia się w bazie. NIestety kiedy próbuje ze strony to nie żadnego efektu.
<?// connect to the database // handle new searches { // get the current time // get the submitted term and prepare it for the database query // check if the term has been submitted before { // the term exists - update the counter and the last search timestamp } else { // the term does not exist - insert a new record } } // prepare the tag cloud array for display $maximum = 1; // $maximum is the highest counter for a search term { $term = $row['term']; $counter = $row['counter']; // update $maximum if this term is more popular than the previous terms if ($counter > $maximum) $maximum = $counter; } // shuffle terms unless you want to retain the order of highest to lowest ?> <!DOCTYPE html> <html> <head> <title>Tag Cloud Example</title> <style type="text/css"> #tagcloud { width: 300px; background:#CFE3FF; color:#0066FF; padding: 10px; border: 1px solid #559DFF; text-align:center; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } #tagcloud a:link, #tagcloud a:visited { text-decoration:none; color: #333; } #tagcloud a:hover { text-decoration: underline; } #tagcloud span { padding: 4px; } #tagcloud .smallest { font-size: x-small; } #tagcloud .small { font-size: small; } #tagcloud .medium { font-size:medium; } #tagcloud .large { font-size:large; } #tagcloud .largest { font-size:larger; } </style> </head> <body> <h1>Search</h1> <form id="search" method="get" action="?action=Search"> <input type="text" name="term" id="term" /> <input type="submit" name="submit" id="submit" value="search" /> </form> <h2>Popular Searches</h2> <div id="tagcloud"> <?php // start looping through the tags foreach ($terms as $term): // determine the popularity of this term as a percentage // determine the class for this term based on the percentage if ($percent < 20): $class = 'smallest'; elseif ($percent >= 20 and $percent < 40): $class = 'small'; elseif ($percent >= 40 and $percent < 60): $class = 'medium'; elseif ($percent >= 60 and $percent < 80): $class = 'large'; else: $class = 'largest'; endif; ?> </span> <?php endforeach; ?> </div> </body> </html>
Proszę o pomoc.
Pozdrawiam