Results 1 to 2 of 2
  1. #1
    Pligg Donor longcountdown's Avatar
    Joined
    Nov 2007
    Posts
    75
    Thanks
    Received:0
    Given: 0

    Question How could you not show specific tags?

    I'm looking for a way to prevent certain tags showing in the tag cloud.

    I have a Japan-themed Pligg site, so all the articles submitted are about Japan. The problem is that so many users put "Japan" as a tag so when you look at the tag cloud, the word "Japan" is huge, and all the other tags are really small.

    There seems to be two approaches: 1) Disallow users to use that tag in the first place, and 2) Ignore the tag when building the tag cloud from the database.

    I would prefer to see a solution for (2) because I wouldn't want to annoy the users with "That tag can't be used" messages all the time.

    Does anyone else have the same problem, and can anyone provide a solution for it?

  2. #2
    Pligg Donor longcountdown's Avatar
    Joined
    Nov 2007
    Posts
    75
    Thanks
    Received:0
    Given: 0

    A solution for hiding tags

    I was able to come up with a solution for this myself. It works nicely because the user is oblivious to it. Even if the user types in 'Japan', it won't show up in the cloud. However, the tag still works when you do a search and it's still in the tag list under each title, just as the user would expect.

    Tested in version 9.8.2

    1. Open libs/tags.php

    2. Locate this line:

    Code:
    $max = max($db->get_var("select count(*) as words $from_where order by words desc limit 1"), 2);
    3. Change it to this (note the changes in red):

    Code:
    $max = max($db->get_var("select count(*) as words $from_where order by words desc limit 1, 1"), 2);
    What that does is it gets the second most popular tag and uses it as the max limit for the font size.

    4. Locate this line:

    Code:
    foreach (array_keys($words) as $theword) {
    5. Wrap the statements within the for loop in an if statement like this:

    Code:
    foreach (array_keys($words) as $theword) {
    				if($theword != 'japan') {
    					$tag_number[$tagnumber] = $tagnumber;
    					$tag_name[$tagnumber] = $theword;
    					$tag_count[$tagnumber] = $words[$theword];
    					$tag_size[$tagnumber] = $tags_min_pts + ($tag_count[$tagnumber] - 1) * $coef;
    				
    					if(isset($time_query)){
    						$tag_url[$tagnumber] = getmyurl('tag2', urlencode($tag_name[$tagnumber]), $from_time);
    					} else {
    						$tag_url[$tagnumber] = getmyurl('tag', urlencode($tag_name[$tagnumber]));
    					}
    				
    					$tagnumber = $tagnumber + 1;
    				}
    			}
    Change 'japan' to the tag you want to hide.

    6. Upload libs/tags.php and you're done.

    Note that the above will only hide the most popular tag. If you want to hide the top 2 tags you'll need to edit the above like this (untested!):

    Code:
    $max = max($db->get_var("select count(*) as words $from_where order by words desc limit 2, 1"), 2);
    Code:
    if(($theword != 'japan') || ($theword != 'japanese')) {
    I hope some people find this helpful.

Similar Threads

  1. Show submited url in {php} tags
    By voxxxlll in forum Questions & Comments
    Replies: 5
    Last Post: 02-10-2011, 11:28 AM
  2. Admins tags does not show up
    By rask in forum Questions & Comments
    Replies: 0
    Last Post: 02-04-2009, 09:01 AM
  3. How can I show articles from a specific ...
    By wishmaster22 in forum Questions & Comments
    Replies: 0
    Last Post: 08-11-2008, 08:11 PM
  4. Tags dont show
    By calebeaires in forum Questions & Comments
    Replies: 0
    Last Post: 10-17-2007, 04:41 AM
  5. Sitebat top 5 tags: why not show top 20 tags
    By spatznick in forum Questions & Comments
    Replies: 2
    Last Post: 02-10-2007, 07:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg