No mate, put this back where it was. The code that I gave you only inserts the searched keywords into the database. It has nothing to do with the script which displays it later. Now go to tags.php and they should show up.
yes is work is work fine thanks you thanks you very much just one another ques with that script he will request to database 2 time whay we can not he use from the config.php in header all information and thanks you again you willy help me you are the best man thanks
Sorry, I'm a bit lost. Do you want to include config.php in tag.php and use the database information from there? You can do it this way: If a permanent connection is established just take this part out: mysql_connect('xxxxxxxxx', 'xxxxxxxxxx', 'xxxxxxxxx'); mysql_select_db('xxxxxxxxxxx'); PHP: If you don't have a permanent connection, do it this way: function get_tag_data() { // Globalize the variables in the config.php file which hold the database information: global $username, $password, $hostname, $database; mysql_connect($hostname, $username, $password) mysql_select_db($database); $result = mysql_query("SELECT * FROM tags GROUP BY tag ORDER BY count DESC"); while($row = mysql_fetch_array($result)) { $arr[$row['tag']] = $row['count']; } ksort($arr); return $arr; } PHP:
thanks nico_swd you are the best thanks you we forget something in this script how make the limit postin of tag bescose he gowing and will be more big how we can make a limit of print tag for exemple print limit 50 tag post new tag delet old tag ot hide to kip it just 50 tag and thanks you again
In your get_tag_data function, replace this: return $arr; PHP: With: return array_splice($arr, 50); PHP: Where 50 is the amount of tags which the function will return. If you want to get the most popular tags only, remove this line: ksort($arr); PHP:
This one worked for me me no problems.. <?php /***************************************************************************** Tag Cloud Developer : Miles Johnson Email : mileswjohnson@gmail.com Website : http://www.mileswjohnson.com/ Last Edit : January 4th 2007 ****************************************************************************** ABOUT: Creates a tag cloud with tags taken from a database. Tags are then given a unique number for how many tags are unique, and then a font size is chosen. READ ME: You must initiate your own database, and be sure to change the query below to match your table and column. Within my tag system, tags are inserted into a varchar column, and seperated by a comma and a space, as so: miles, johnson, designer, tag, cloud For the explode to work properly, you must also do it this way, or change the explode to match however you enter your tags into your database. ******************************************************************************/ // Create the tag function function getTags($minFont=10, $maxFont=35) { $tags = array(); $cloud = array(); // Grab the tags from the database $query = mysql_query("SELECT tags FROM news ORDER BY RAND()"); while($t = mysql_fetch_array($query)) { $db = explode(', ', $t[0]); while(list($key, $value) = each($db)){ $tags[$value] += 1; } } // Get totals to use for font size $min = min(array_values($tags)); $max = max(array_values($tags)); $fix = ($max - $min == 0) ? 1 : $max - $min; // Display the tags foreach ($tags as $tag => $count) { $size = $minFont + ($count - $min) * ($maxFont - $minFont) / $fix; $cloud[] = '<a style="font-size: '. floor($size) .'px" class="cloud" href="#" title="Tag: '. ucfirst($tag) .' was used '. $count .' times!">'. htmlspecialchars(stripslashes(ucfirst($tag))) . '</a>'; } $shown = join("\n", $cloud) . "\n"; return $shown; } ?> <?php echo getTags(10, 30); ?> Code (markup):
thanks donteatchicken for replay in this script what i should change to make it work becose i am not good in php so what i have to change with my other script