1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

help woth cloud tag

Discussion in 'PHP' started by member1, May 12, 2007.

  1. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #21
    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.
     
    nico_swd, May 14, 2007 IP
  2. member1

    member1 Active Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #22
    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
     
    member1, May 14, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #23
    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:
     
    nico_swd, May 15, 2007 IP
  4. member1

    member1 Active Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #24
    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
     
    member1, May 17, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #25
    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:
     
    nico_swd, May 17, 2007 IP
  6. member1

    member1 Active Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #26
    i did it but he show just the last tag he shwos just 7 tag
     
    member1, May 17, 2007 IP
  7. donteatchicken

    donteatchicken Well-Known Member

    Messages:
    432
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    118
    #27
    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):
     
    donteatchicken, May 17, 2007 IP
  8. member1

    member1 Active Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #28
    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
     
    member1, May 18, 2007 IP
  9. member1

    member1 Active Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #29
    any help please
     
    member1, May 19, 2007 IP
  10. member1

    member1 Active Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #30
    any help please
     
    member1, May 25, 2007 IP