Tagcloud Plugin v1.5

  • Hi and thanks for the updated plugin. Do you know how to make it display the tags in different colors?

  • 2elggboy:

    1. Open tagcloud/views/default/output/tagcloud.php

    2. Find this line: 

    if ($size < 60) $size = 60;

    3. Place next code below:

    if ($tag->total < 3) {

    $color = "#1560BD";

    if ($tag->total == 3) {

    $color = "#aa0685";

    }

    if ($tag->total == 4) {

    $color = "#00A86B";

    if ($tag->total == 5) {

    $color = "#00FF00";

    if ($tag->total == 6) {

    $color = "#FFCC00";

    if ($tag->total == 7) {

    $color = "#CC5500";

    }

    if ($tag->total == 8) {

    $color = "#FF4500";

    }

    if ($tag->total == 9) {

    $color = "#964B00";

    }

    if ($tag->total == 10) {

    $color = "#FF4500";

    }

    if ($tag->total == 11) {

    $color = "#960018";

    }

    if ($tag->total > 11) {

    $color = "red";

    }

    4. Change this line:

    $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" . htmlentities($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";

    To next one:
    $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%; color: {$color}\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" . htmlentities($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";
    It seems all. ;-)
  • Is there a way to exclude wire posts from the cloud?

    I do not know if it is still like this but thewire was saving every word as a tag which results in "big" tags for words like "and" and so on.

  • @Dahaniel - The wire stores the text in the description field on an ElggObject. The words will not show up as tags.

  • @Cash - Yes, I just saw that, but a older version of thewire, every single word was saved as a tag. So no I have to find a way to delete all the old "bad" tags....

    How can I find a tag in the database? Is it in the metasrtings table? And could I simply delete it from there?

  • @Dahaniel - I don't know the structure of the old wire so I can't tell you exactly how to remove old wire posts. If it was an object with each word as a piece of metadata, you'll have to work with the entities table, object table, metadata, and possibly the metastring table. It might be possible to write a script that calls core Elgg functions that deletes the entity and all associated data.

    Tags are metadata. First find the string "tags" in the metastrings table and note its id. Then search the metadata table for name_id = that id. This will be all the tags. To find the value of the tag, note its value_id and look in the metastring table for it.

  • Anyone know how i make this sweet modshow up in the front page??

     

    Ade

  • What front page do you mean?  (You could mean the front if you're not logged in, the front if you are, a side panel if you use the river alternative dashboard...)

    As specified above, you get the array of the tags with the statement:

    $tagcloud = frontpage_tagcloud(25);

    Then you have to create the HTML around it.  One way to see what that looks like is to look at the widget rendering code looks like and copy that.

     

  • @Cash: Thank you for the hint, I think I do understand now how I would have to delete them. They are all tags. I think I will have to learn some mysql and write a tag management plugin, or I export everything and try to work with excel/openoffice ;)

  • I did and it everything turns red. :-)

  • woot thanks for this hope it works.

  • If you want to add this to the custom_index you can use the following:

    <?php
        if(is_plugin_enabled('tagcloud')){
    ?>
            <!-- display latest tags -->
            <div class="index_box">
                <h2>Tag cloud</h2>
                <div class="contentWrapper")
                <?php
                    echo display_tagcloud( 1, 25, "tags");//this will display tags
                ?>
            </div>
            </div>

    Just add it to:

    mod/custom_index/viewsdefault/canvas/layouts/new_index.php

  • @Inde

    That won't have random tag sorting. To do that replace

    echo display_tagcloud( 1, 25, "tags");

    with

    echo frontpage_tagcloud(25);

  • Correction from Cash!

     

    <?php
        if(is_plugin_enabled('tagcloud')){
    ?>
            <!-- display latest tags -->
            <div class="index_box">
                <h2>Tag cloud</h2>
                <div class="contentWrapper")
                <?php
                    echo frontpage_tagcloud(25);//this will display tags
                ?>
            </div>
            </div>

     

    Just add it to:

    mod/custom_index/viewsdefault/canvas/layouts/new_index.php

  • Oh, and make sure you include the closing bracket if you're doing what Inde Uppal suggests:

    <?php } ?>

    Add it after the final </div>

  • @cash

    Have you found any issues in getting to work with internet explorer and opera?

  • @Inde - The markup is very simple and should work in any browser. I tested with FF, IE, and Opera. The tag cloud respects the permissions on content so if you hit a page and are not logged in and all your content has the access level of "logged in", no tags will show up. Hope that makes sense.

  • @Cash

    Cheers for the plugin, although I dont understand why it only show your tags in it and not the tags of all the files/blog/etc from across the site, like the 1.2 one did.

    Am I missing something?

    Regards.

  • @munkee - do you want that? I thought if the cloud widget was used on a profile, someone wanted to show their tags rather than everyone's tags. If you put it on the frontpage with the frontpage_tagcloud(); function, it does show all site tags (depending on permissions).

  • @Cash - We've got users that liked that feature of the old tagcloud, is it possible to add to the code ?

    I suppose once they are logged in they just like being nosey, and like to have them to click, to see what content it takes them to :)

  • @munkee - find this line in the widget view.php:

    echo display_tagcloud(1, $num_items, 'tags', 'object', '', page_owner());

    and change to

    echo display_tagcloud(1, $num_items, 'tags');

     

  • @Cash Awesome !  Cheers

  • this is just what I want for my site, GREAT!

    but i want a little modification please, what if I want to pull the tags which are only under a certain field in the profiles, let's say the interest field or some specific field that I've added.

    thanks

Stats

  • Category: Widgets
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 4657
  • Recommendations: 3

Other Projects

View Cash's plugins