preload
Tag Cloud Wordpress TinyMCE Image Upload Plugin
Feb 28

Please check out the demo page for examples on how to use the new functions available in this version.

Some of the new features included in the new tag cloud script are:

  • Link and URL Assignment
  • Additional attribute assignment e.g. title etc
  • Add styles and colour options to each tag
  • Set a limit to the amount of tags that are displayed
  • Examples of intergrating with a MySQL Database
  • Examples of intergrating with a Flat Text File
  • String to cloud, parse a single string into a tag cloud instantly
  • Ignore list, to remove particular words from the cloud. e.g. and, the, it, i
  • Ordering by a selective field. e.g. word, size, colour

Tutorial coming soon ...

36 Responses to “Tag Cloud v2”

  1. Terkel Says:

    I can't wait! I love you tag system, and this sounds very good :P Keep up the good work dude

  2. K K Says:

    hi, great class! In my case I modified showCloud function a bit.

    if(strlen($arrayInfo['url'])){
    $return .= "<a href=\'{$arrayInfo[\'url\']}\' class='word size{$sizeRange}'> &nbsp; {$arrayInfo[\'word\']} &nbsp; </a>";
    }else{
    $return .= "<span class=\'word size{$sizeRange}\'> &nbsp; {$arrayInfo['word']} &nbsp; </span>";
    }

    This way I don't need to get array first and create links myself. This might be useful for other users?

  3. Arnaud Says:

    I think your tutorial should also include the Rewrite Engine rule required to make the domain.dom/tag// link work :)

  4. Gabriel Says:

    I had a problem with this code. I wanted to pass a load of strings into it then have it show the top 10 most popular strings. Perhaps i missed somthing.? isnt this the entire point of a TagCloud?

  5. ????? Says:

    Good explane

  6. Tag Cloud . Lots of Code Says:

    [...] Tag Cloud Script (Version 2) is now Available, with more customizable features [...]

  7. Bandorka Says:

    There is a bug at the Limit:

    $i = 1;
    foreach ($this->wordsArray as $key => $value) {
    if ($this->limitAmount < $i) {
    $wordsArray[$value['word']] = $value;
    }
    $i++;
    }

    limitAmount $i

  8. lotsofcode Says:

    @Gabriel
    When you parse a string into the tag cloud class, it converts the string to tags, you can order and limit the tags using specific methods in the class, these are shown in the tutorial.

    @Arnaud
    Good idea, although this isn't really something i can control as each site system will work differently.

    @Bandorka

    Thanks for the comment, could you please expand on this as it's very difficult for me to replicate the bug you are encountering! Looking at the code, it looks fine to me and i have tested the method and i seem to get the desired results ... ?

  9. Articles Says:

    Good post!...

  10. Morticus Says:

    Nice class, great work :)

    Found a bug though, and the fix I believe.

    In the getMax()-method in wordcloud.class.php a "{" and a "}" is missing.

    Before it was this:
    ...
    row 306: if ($c_size > $p_size)
    row 307: $max = $c_size;
    row 308: $p_size = $c_size;

    After my fix:
    ...
    row 306: if ($c_size > $p_size) {
    row 307: max= $c_size;
    row 308: $p_size = $c_size;
    row 309: }

    You can see the bug in action on your demo-page actually. If you view that page and just hits F5 5-10 times you will see how your first Basic Example change appearance (the order), and some times the "weight" of the tags change too. That "randomness" in tag-weight is a bug in my oppinion.

  11. lotsofcode Says:

    Indeed it was a minor bug, thank you for mentioning this it is now fixed ;-) and it works a little smoother and consistent when the page is reloaded.

    As each item was looped through only two items were compared in size, now we store the largest item in size and then compare it to each item as it loops through the array.

    Thanks again!

  12. Fabulousfab Says:

    Hi. I tried to limit the number of words.
    For exemple the top 10 words of a text.
    How to do ?

  13. balloon Says:

    Hi,

    I was wondering how I would go about using an RSS feed as the data source for your cloud script?

    Any help you could provide would be greatly appreciated.

    All the best.

  14. kwan2400 Says:

    Hi,
    Thank you for your script!

    Could You show me an example what is about W/Links & colours MySQL Database?

    If there are three fileds of word, link, color.

    Thank you!

  15. Onig Says:

    Hi,
    the css style sheet doesn't work, all link are blue

    http://www.bigsoftwares.com/searchflickr/word_cloud/tags2.php?feed=http%3A%2F%2Fapi.flickr.com%2Fservices%2Ffeeds%2Fphotos_public.gne%3Ftags%3Dtag%26lang%3Den-us%26format%3Drss_200

  16. Tom Says:

    Thanks for script. Could you please do some more fixes. For example if you have a small array of tags all of them are getting big size classes. This looks not to good on website.

  17. lakaDo Says:

    HOW I CAN SET LIMIT ON MYSQL QUERY? Why $cloud->setLimit(20); dont work :/? :(:(

  18. hyhkd Says:

    Nice Effort , I liked you site !
    Can it tag Arabic words or not ?

  19. HUNTER Says:

    Thanks for script. How i can put russian text as a source words ?

  20. Robert Says:

    how i can set max tags to show in by not mysql version ??

  21. marino Says:

    Hi, this is what i need, great job, thank you. Before I publish om my site i need some help...i can't make tags w/links working when I use $string for language change dynamically, for example:

    $cloud = new wordCloud();
    $cloud->addWord(array('word' => ''$acc'', 'size' => 1, 'url' => 'http://www.link.com'));
    ...
    where $acc is defined before in several language and change it when language=$language

    how can I define $acc string? with echo don't work ether.
    thank you,
    M.

  22. Site Admin Says:

    Is there anyway to a make it so the tag cloud takes the 10 top used words on the website itself and makes a cloud based on those repetitions? That way each page has a unique page cloud based on the content of the individual pages.

  23. gollum Says:

    for a much better speed change all
    return $this->wordsArray;
    to
    return true;

  24. Website Building Tutorials Says:

    I've used this code on a couple of websites now, always works perfectly. Thanks :-)

  25. Joseph Elwell Says:

    I added a new utility function:

    /*
    * Sets a limit for the amount of clouds
    * @example setLimitPercent(.50) will show only 50% of the words
    *
    * @param string $limit as a fraction
    *
    * @returns string $this->limitAmount
    */

    function setLimitPercent($limit)
    {
    if (!empty($limit)) {
    $this->limitAmount = round($limit * count($this->wordsArray));
    }
    return $this->limitAmount;
    }

    -------
    It was too much work in my current code base to keep track of unique words and since tagCloud already knew that amount, this function works out really well.

  26. Tube Says:

    Thankyou. Super code.

  27. Nannu Says:

    Hey Can you please suggest how to write the code for text cloud in java, and if possible can you provide an example

  28. Elizabeth Says:

    So, I love the code examples, it's exactly what I need... except. Except the reading from file one which is of course my most needed aspect of the tag cloud. It reads from the file, but it displays it all as the same tiny text... so I tried passing the contents of the file as a variable into the text string example, with the same results even though when I copied and pasted the files contents into the string directly... no problem, perfect word cloud... any suggestions on why it's not liking files/ variables?

    Thanks for your help.

  29. Charlie Says:

    Thanks for the awesome Tag Cloud software!

    The only issue is I cannot get it to display only the top, say, 10 tags. I have tried the setLimit function but it always returns the entire list of tags. Maybe there is some incorrect implementation I am doing, but I have tried it according to the tutorials and I am not getting the desired output. Thanks again!

  30. Rjs37 Says:

    In-case anyone else is having issues with the limit function I've found the problem. There were two issues.

    Firstly the limit variable was being treated as a string (as far as I can tell) and not a number. To fix this just add a simple intval to the setLimit function like so: $this->limitAmount = intval($limit);

    Secondly the if statement in the limitCloud function is the wrong way around. Either swap the two variables around or turn the .

    I hope that fixes your problems like it fixed mine.

  31. Rjs37 Says:

    Either swap the two variables around or turn the < into >*

    I didnt realize that it would strip those characters from my last post.

  32. Ult1mate Says:

    @Charlie:
    I've been experiencing the same issue! It just constantly returns the entire list of tags no matter what I try!

    HELP US OUT PLEASE:
    How do you set the number of tags???

  33. Jan Says:

    Hi,

    it's possible, to do something like:

    $cloud->addWord(array('word' => 'lotsofcode', 'size' => 4, 'url' => 'http://www.lotsofcode.com', 'colour' => '#FFFF00'));

    with a flat file? I mean I want to use a flat file AND links.

    Any hints?

    regards
    Jan

  34. fixit Says:

    fix for the limit bug:
    change limitCloud() line 214:
    from "if ($this->limitAmount < $i) {"
    to "if ($i limitAmount) {"

  35. fixit Says:

    didnt paste it right...

    fix for the limit bug:
    change limitCloud() line 214:
    from "if ($this->limitAmount < $i) {"
    to "if ($i limitAmount) {"

  36. Stewart McKie Says:

    First, thanks for providing this class as for non-programmers like me it helps a lot.

    I'm using the class to create a word cloud from a text column in my mySQL database and so far it's working great. I've come across some issues (some mentioned above).

    1. I can't get the limit function to work either. Whatever I put in $cloud->setLimit(); returns all the words.

    2. Did anyone figure out doing top(n) as I was hoping to a top (50) by frequency.

    3. Is there a 'exclude by frequency' function so that only words with a frequency of (say) over 10 mentions are included?

    4. Regarding stoplists, is there any way to:

    a. refer to multiple stoplist terms rather than do a $cloud->removeWord('a'); for each term
    b. or better still refer to a stoplist file e.g. stoplist.txt

    Thanks again for making this class available.

Leave a Reply

 
 
Please enter the word above into the box below, the word is not case sensitive.
 
If you have trouble reading the word above then click here to load a new word.
Security word: