[ zrnoo @ 27.08.2007. 16:20 ] @
hocu da uradim tag clouds (obblak na sajtu) i hocu da mi on obracunava sve reci iz jednog polja, a ne da ga racuna kao celu rec. Znaci ako pise recimo kod korisnika Marka u tag polju Metla Kramp Lopata Cigla .. itd ja hocu da mi ona izvadi svaki ponaosob i da ga racuna kao zaseban tag*i sabira sa ostalim korisnicima radi velicine slova) a ne kao jednu rec od tih 4 reci! nadam se da me kapirate!
Evo primer koda skripte koj radi. Ali ona vadi iz polja sve sto pise i racuna kao JEDNU rec!!! a meni to netreba nego ono od malocas sto sa mnapisao!
inace svi podaci koji su mi upisani u tolje tag su sa razmakom, primer:( metla kramp lopata...)

Ako neko ima skriptu ili adresu ili neki tutorijal neka okaci ovde..Jako mi je potrebna!

Code:

<?php 

// connect to database at some point


// In the SQL below, change these three things:
// thing is the column name that you are making a tag cloud for
// id is the primary key
// my_table is the name of the database table

$query = "SELECT thing AS tag, COUNT(id) AS quantity
  FROM my_table GROUP BY id order by id";

$result = mysql_query($query, $conn1)or die(mysql_error());

// here we loop through the results and put them into a simple array:
// $tag['thing1'] = 12;
// $tag['thing2'] = 25;
// etc. so we can use all the nifty array functions
// to calculate the font-size of each tag
while ($row = mysql_fetch_array($result)) {

    $tags[$row['tag']] = $row['quantity'];
    // same index as tags array
    $category_id[$row['tag']] = $row['name'];
}

// change these font sizes if you will
$max_size = 250; // max font size in %
$min_size = 100; // min font size in %

// get the 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 (0 == $spread) { // we don't want to divide by zero
    $spread = 1;
}

// determine the font-size increment
// this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread);

// loop through our tag array
foreach ($tags as $key => $value) {

    // calculate CSS 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 = $min_size + (($value - $min_qty) * $step);
    // uncomment if you want sizes in whole %:
    // $size = ceil($size);

    // you'll need to put the link destination in place of the #
    // (assuming your tag links to some sort of details page)
    echo '<a href="tag?t=" style="font-size: '.$size.'%"';
    // perhaps adjust this title attribute for the things that are tagged
    echo ' title="'.$value.' things tagged with '.$key.'"';
    echo '>'.$key.'</a> ';
    // notice the space at the end of the link
}

?>
[ Nemanja Avramović @ 27.08.2007. 18:09 ] @
Jednostavno: proveriš da li string (tag) sadrži razmak. Ako sadrži, razbiješ ga po space karakteru i eto ti niz različitih tagova.
[ zrnoo @ 27.08.2007. 18:46 ] @
jel mozes malo da mi pomognes na ovom mom primeru ???
[ zrnoo @ 07.09.2007. 00:22 ] @
jel ima neko? neide mi nikako, pokusavam, al me stalno nesto koci!? :(
[ dakipro @ 07.09.2007. 08:01 ] @
Sta pokusavas i sta te koci, konkretno. Jel hoces gotov kod?