Delicious tag cloud using Zend framework


Posted in: php | Save to del.icio.us |

Zend framework provides many interesting wrappers for major service APIs like Akismet, Amazon, Audioscrobbler, Delicious, Flickr, Nirvanix, etc.

In this post we will use the delicious wrapper to create a tag cloud for your delicious account.


sdsd.

Now that we have all the tags with us we will display them as a cloud with weight attached to each tag. The font size of each tag will be set depending on the number of posts for that particular tags. For e.g a tag named “php” having 45 posts will have the font size set to 30 px while a tag “flash” having 2 posts will have the font size set to 10 px.


sdsd.

Here’s what the output will look like. The tags visited are in blue.


sdsd.

Download code

3 Responses

1

kiran aghor

April 8th, 2008 at 8:28 am

kool. How easy it that…

2

mcguillan

August 10th, 2009 at 2:13 am

The script does not work properly, because the max is unknown at the beginning.

3

mcguillan

August 10th, 2009 at 2:22 am

In order to make it work you just have to add another foreach before the foreach with the print to get the min and max:

foreach ($tags as $tagName=>$tagCount)
{
$cnt = $tagCount;

if ($cnt > $maxTagCount) $maxTagCount = $cnt;
if ($cnt < $minTagCount) $minTagCount = $cnt;
}

Comments are disabled for this post, but if you have spotted an error, feel free to contact me.