NP_TechnoratiTags (v0.9.x, now a functional tagging system)

Post your new plugins here!
User avatar
wessite
Posts: 205
Joined: Sun Sep 10, 2006 10:20 am
Location: Belgium, Antwerp
Contact:

filter less used tags

Postby wessite » Mon Nov 05, 2007 7:19 pm

Hello,

I am using the technoratitags plugin and I am very happy with it,

but I have added pretty much tags, look here http://www.bmxaction.net/tags

Is there a way to filter the 1st level tags out or something, the less used tags. because the tag cloud is getting pretty big.

greets
wessite
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Re: filter less used tags

Postby admun » Tue Nov 06, 2007 4:10 pm

wessite wrote:Hello,

I am using the technoratitags plugin and I am very happy with it,

but I have added pretty much tags, look here http://www.bmxaction.net/tags

Is there a way to filter the 1st level tags out or something, the less used tags. because the tag cloud is getting pretty big.

greets
wessite

Right now, there is a plugin option "Amount of tags (by percentage) to show on tag cloud (100% == show all tags)" you can used
User avatar
wessite
Posts: 205
Joined: Sun Sep 10, 2006 10:20 am
Location: Belgium, Antwerp
Contact:

Postby wessite » Wed Nov 07, 2007 9:50 am

Ok, I'll give it a try.

Thanks
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

problem using technoratitags

Postby findingrico » Wed Sep 24, 2008 7:11 am

i've got a problem where the plugin shows a number with a link (but that number is not a tag at all)...

let's say if I use it with these parameters:

Code: Select all

<%TechnoratiTags(localcloud,pop, 6)%>


to show a cloud of top 6 tags... then it will give me an output like this:

thoughts songs 0 humor scream Beatles

now let's say I try with 30 tags:

thoughts songs 0 humor scream Beatles work update UP Sir Paul McCartney trivia cats demotivators email movies Windows XP tuition fee hike team disaster response John Lennon dogs photos Convergys music pics 1 anime John Mayer eraserheads reunion concert

what's making this?
Rico

"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Re: problem using technoratitags

Postby admun » Wed Oct 01, 2008 1:09 am

findingrico wrote:i've got a problem where the plugin shows a number with a link (but that number is not a tag at all)...

let's say if I use it with these parameters:

Code: Select all

<%TechnoratiTags(localcloud,pop, 6)%>


to show a cloud of top 6 tags... then it will give me an output like this:

thoughts songs 0 humor scream Beatles

now let's say I try with 30 tags:

thoughts songs 0 humor scream Beatles work update UP Sir Paul McCartney trivia cats demotivators email movies Windows XP tuition fee hike team disaster response John Lennon dogs photos Convergys music pics 1 anime John Mayer eraserheads reunion concert

what's making this?

There must be some post(s) associate w/ the tag. When you click on the link to the unknown tag, does any post tag to it?

Do you have a link I can take a look?
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Fri Oct 17, 2008 1:51 am

Well, I definitely did not use those tags. Yes, clicking on the numbers 0..1..2.. etc give results.

check it out on my site: http://myglassonion.exofire.net

the tagcloud is on the sidebar.

thanks for the help!
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Fri Oct 17, 2008 2:11 am

findingrico wrote:Well, I definitely did not use those tags. Yes, clicking on the numbers 0..1..2.. etc give results.

check it out on my site: http://myglassonion.exofire.net

the tagcloud is on the sidebar.

thanks for the help!

hum..... it looks weird indeed.

I can see post related to the tag '0'

http://myglassonion.exofire.net/tags.php?tag=0

But when I look at your tagcloud, these incorrect tags are not there:

http://myglassonion.exofire.net/index.php?special=cloud

Did you make changes to the code? Also how you call the plugin from the sidebar? It looks like you are only showing top x tags in the sidebar... maybe a bug there, but I need to know how you call the plugin to investigate more.

Also, if you are familiar w/ SQL, check the plug_technoratitags table to see if any tags of '0' and '1'
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Fri Oct 17, 2008 4:43 pm

I didn't make any changes to the code...

But when I look at your tagcloud, these incorrect tags are not there:

http://myglassonion.exofire.net/index.php?special=cloud


That's right. When it shows everything, the incorrect tags doesn't show. But when you limit the results, then the incorrect tags show. I call the tagcloud in the sidebar using


Code: Select all

<%TechnoratiTags(localcloud,pop, 30)%>


Also, if you are familiar w/ SQL, check the plug_technoratitags table to see if any tags of '0' and '1'


I already checked, but there are no tags in the table for the incorrect tags.

Also, if I increase the limit of the results, more incorrect tags show (0, 1, 2, ...)

I just changed it to..

Code: Select all

<%TechnoratiTags(localcloud,pop, 80)%>


Then this shows...
http://myglassonion.exofire.net
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Sun Oct 19, 2008 7:06 pm

findingrico,

One more question, what version of PHP you are using?

I am on php 5.2.6... not sure that has something to do with it.

I will find somethings and dig in to the code and check.
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Tue Oct 21, 2008 10:44 pm

PHP ver 5.2.5 it says on the hosting site...
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Thu Oct 30, 2008 1:08 am

findingrico wrote:PHP ver 5.2.5 it says on the hosting site...

Let me see if I can come up with a debug code for you to test.... stay tuned.
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Thu Oct 30, 2008 8:52 pm

admun wrote:
findingrico wrote:PHP ver 5.2.5 it says on the hosting site...

Let me see if I can come up with a debug code for you to test.... stay tuned.


thanks! will do.
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Fri Oct 31, 2008 11:27 pm

findingrico wrote:
admun wrote:
findingrico wrote:PHP ver 5.2.5 it says on the hosting site...

Let me see if I can come up with a debug code for you to test.... stay tuned.


thanks! will do.

Hi,

I am testing out the plugin, can you tell me your plugin option setting? I still could not reproduce the problem on my testbed.... :?
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Sat Nov 01, 2008 6:49 pm

admun wrote:
findingrico wrote:
admun wrote:
findingrico wrote:PHP ver 5.2.5 it says on the hosting site...

Let me see if I can come up with a debug code for you to test.... stay tuned.


thanks! will do.

Hi,

I am testing out the plugin, can you tell me your plugin option setting? I still could not reproduce the problem on my testbed.... :?


TechnoratiTags
By: Horst Gutmann, mod by Edmond Hui, Adam Harvey
Version: 0.9.5


Look of the list: <br/><br/>tags: %l

Separator of the tags when being displayed: ,

Look of the tags (%TAGURL% is the URL to Technorati/del.icio.us, leave alone): <a href="%TAGURL%/%t" rel="tag">%d</a>

Text string for no tag

Tags table should be removed when uninstalling this plugin No

Display "+" as " " (space)? Yes

Insert tags at the end of post? Yes

Type of tags insert to the end of post Technorati

Tag search title text Tag Search Result for

Show number of posts on each tag in a local cloud No

Add post to each tag in del.icio.us? (user need to set his/her login & password from member setting) Yes

Amount of tags (by percentage) to show on tag cloud (100% == show all tags) 100

Number of Tags to hold in memory for tag auto completion 200


update:

I tried to uninstall the plugin, and delete the files on my server, just in case that I might have forgotten that I messed w/ the code. I backed up the technorati tags table.

I uploaded then the install files I downloaded from your site (v0.9.5) and reinstalled. of course w/ nothing in the tags table, it gave me bunch of errors abt it being empty. So I reloaded my tags to the table. still it didn't correct itself, the incorrect tags still show... hmmm...
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Sun Nov 09, 2008 7:40 pm

Ok, here's the instruction for some debugging, required adding 3 lines in the plugin file.

1) open the NP_TechnoratiTags.php in editor
2) look for function getAllTags() ~line 254
3) look for "$tagcloud = array_count_values( $alltags );" in this function
4) on top of this line add the following:

echo "<!--";
print_r($alltags);
echo "-->";

After this when you look at the source of the page, you should see a commented out segment, which dump all tags raw data. You can posted them here or let me know to go visit your blog. We can debug it from this bump and see if we find out what is the problem.
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Mon Nov 10, 2008 10:50 pm

i've already made the additional debug code. you can look at it at http://myglassonion.exofire.net

looking at the source, it gave me 301 tags, none of them the incorrect tags. hmm...

there seems to be nothing wrong the way the tags are read from the beginning.

there must be something on the function when you actually put delimiters on what to show (like the top 80 tags, etc...) where is it located in the code?

update::

i think i found the error.

i inserted the debug code at the function where it sorts the tags by popularity, and comparing the results, the incorrect tags correspond to the tags that are actually years (2008, 2007)


[thoughts] => 43
[songs] => 33
[2008] => 21
[humor] => 15
[scream] => 12
[Beatles] => 8

shows

thoughts songs 0 humor scream Beatles



[team] => 2
[dogs] => 2
[2007] => 2
[reunion+concert] => 2
[photos] => 2

shows

team dogs 1 reunion concert photos

[traffic] => 1
[1983] => 1
[Ukraine] => 1

shows
traffic 2 Ukraine
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Tue Nov 11, 2008 9:59 am

findingrico wrote:i think i found the error.

i inserted the debug code at the function where it sorts the tags by popularity, and comparing the results, the incorrect tags correspond to the tags that are actually years (2008, 2007)


[thoughts] => 43
[songs] => 33
[2008] => 21
[humor] => 15
[scream] => 12
[Beatles] => 8

shows

thoughts songs 0 humor scream Beatles



[team] => 2
[dogs] => 2
[2007] => 2
[reunion+concert] => 2
[photos] => 2

shows

team dogs 1 reunion concert photos

[traffic] => 1
[1983] => 1
[Ukraine] => 1

shows
traffic 2 Ukraine

You are referring to the arsort() and ksort() calls? They are from build-in PHP..... I will look further into it.
User avatar
admun
Nucleus Guru
Nucleus Guru
Posts: 4088
Joined: Mon Oct 20, 2003 2:57 am
Location: San Francisco, CA, USA
Contact:

Postby admun » Tue Nov 11, 2008 10:10 am

Ok, look up the php doc on ksort()... there might be a subtle bug on sorting mix type... I think 2008/2007 is treat as number instead of string....

try to change:
arsort($tags); to arsort($tags, SORT_STRING);
asort($tags); to asort($tags, SORT_STRING);
ksort($newtags); to ksort($newtags, SORT_STRING);
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Tue Nov 11, 2008 10:11 pm

i tried to change them as such, but it didn't help, it even messed up the sorting too, so i put things back.

I think this would have to do with when the cloud is actually displayed.... the error actually happens when the $newtags array is sliced to show only the top x tags

you can check the source on the sidebar.

for comparison, i put the debug code on the sorting function.

Code: Select all

         if ($sort == 'pop') {
            arsort($tags);
            $newtags = array();
            $newtags = $tags;
            
            echo "<!--";
            print_r($newtags);
            echo "-->";


will show

Code: Select all

    [thoughts] => 43
    [songs] => 33
    [2008] => 21
    [humor] => 15
    [scream] => 12
    [Beatles] => 8


and then on the slicing function.

Code: Select all

         // Show only x tags
         if ($maxtags > 0) $newtags = array_slice($newtags, 0, $maxtags);
         
            echo "<!--";
            print_r($newtags);
            echo "-->";



will show

Code: Select all

    [thoughts] => 43
    [songs] => 33
    [0] => 21
    [humor] => 15
    [scream] => 12
    [Beatles] => 8



I just don't know how to get around on this.
Rico



"The uncertainty that darkness brings can humble even the hardest soul."
User avatar
findingrico
Posts: 45
Joined: Thu Mar 30, 2006 9:31 pm
Location: Quezon City, Philippines
Contact:

Postby findingrico » Wed Nov 12, 2008 5:18 pm

UPDATE:

I think I found the solution.

I looked up the array_slice function in PHP, and found this..

The array_slice() function returns selected parts of an array.

Syntax

Code: Select all

array_slice(array,start,length,preserve)


preserve Optional. Possible values:
true - Preserve keys
false - Default - Reset keys

Note: If the array have string keys, the returned array will allways preserve the keys.

So what it was doing was since the tags were the keys and 2008/2007 were not strings, they get reset. So I added the preserve option and it corrected everything.

Code: Select all

if ($maxtags > 0) $newtags = array_slice($newtags, 0, $maxtags, true);


Thanks for the help!
Rico



"The uncertainty that darkness brings can humble even the hardest soul."

Return to “Plugin Development”