PDA

View Full Version : Tag Cloud


terrun
01-07-2007, 09:48 PM
Hi Forum!
I would insert a tag cloud into the eSyndiCat Directory Script. I found this snippet for TagCloud

function printTagCloud($tags) {
// $tags is the array

arsort($tags);

$max_size = 32; // max font size in pixels
$min_size = 12; // min font size in pixels

// 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 ($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
$size = round($min_size + (($value - $min_qty) * $step));

echo '<a href="#" style="font-size: ' . $size . 'px" title="' . $value . ' things tagged with ' . $key . '">' . $key . '</a> ';
}
}

$tags = array('weddings' => 32, 'birthdays' => 41, 'landscapes' => 62, 'ham' => 51, 'chicken' => 23, 'food' => 91, 'turkey' => 47, 'windows' => 82, 'apple' => 27);

printTagCloud($tags);


Is this snippet good for the new mod?
Who can help me?


Sorry for my bad english

Mominur Rahman
07-22-2007, 06:28 PM
Not working

woostar
07-22-2007, 07:01 PM
Not working

yes it does.

You can actually make tagclouds on the fly by using that code and a php keyword analyzer class.
Example: http://www.woostar.com/keywords/?url=http://www.esyndicat.com (you can put any url on the end)


If fact I great addition for eSyndicat would be, for every link submitted it automatically scanned the page and stored related keywords based on what was actually on their website.

woostar
07-23-2007, 03:26 AM
Thanks for that code btw terrun... been having a play with it and is very useful :D

Mominur Rahman
07-23-2007, 06:50 PM
Cooooool. But how I can use it with esyndicat. I tried to insert it using banner. But not worked. How can I insert it in left column?

woostar
07-23-2007, 07:00 PM
I believe that it's included in the new release 2.2 - Should be done by the end of the month (so I'm led to believe).