Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Sort order for YahooSubcats

Quote Reply
Sort order for YahooSubcats
I'm using the YahooSubcats plugin. How can I sort sub categories alphabetically under the main categories on my home page? At this stage the ordering seem pretty random.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Sort order for YahooSubcats In reply to
Additionally, I'd like to be able to display the number of links in each sub category and whether there are new links in YahooSubcats In the same way they are displayed following each normal category - e.g.

United States (21)
Alabama (3) new, Alaska (7), Arizona (5),...

Safe swoops
Sangiro

Last edited by:

sangiro: Feb 22, 2003, 9:18 PM
Quote Reply
Re: [sangiro] Sort order for YahooSubcats In reply to
Try this post:

http://www.gossamer-threads.com/...i?post=181638#181638
Quote Reply
Re: [afinlr] Sort order for YahooSubcats In reply to
Thanks! I missed that one in my search somehow. Blush Anyone have a solution for my second question?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Sort order for YahooSubcats In reply to
Hi,

It would mean editing the plugin. You would need to change:

my $sth=$table->select({'FatherID' => $catid},['Full_Name','Name']);

and include 'Number_of_Links' as a column to select, and then change:

$description.=qq|<a href="$cat_url"><$cfg->{subcat_font}>$row->{Name}</font></a>|;

to:

$description.=qq|<a href="$cat_url"><$cfg->{subcat_font}>$row->{Name}</font></a> ($row->{Number_of_Links})|;

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Sort order for YahooSubcats In reply to
Thanks Alex,

That worked just fine. In an attempt to add a new tag when there's a new link I also and included 'Has_New_Links' as a column to select and then added the the code below...

Code:
if ($cfg->{Has_New_Links} eq 'Yes') {
$description.="new";
}

...as a seperate line right after:

$description.=qq|<a href="$cat_url"><$cfg->{subcat_font}>$row->{Name}</font></a> ($row->{Number_of_Links})|;

No luck though. What changes do I need to make to that piece of code to get it to display "new"?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Sort order for YahooSubcats In reply to
You want $row->{Has_New_Links}, not $cfg.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Sort order for YahooSubcats In reply to
I tried that and I get a:

GT::Plugins (18039): Error running plugin PRE hook: Plugins::YahooSubcats::create_subcats. Reason: Global symbol "$row" requires explicit package name at .... line 64

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Sort order for YahooSubcats In reply to
Hmm, sounds like you made a typo. Undo your changes and just do:

$description.=qq|<a href="$cat_url"><$cfg->{subcat_font}>$row->{Name}</font></a> ($row->{Number_of_Links})|;
$description .= qq| NEW! | if ($row->{Has_New_Links});

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Sort order for YahooSubcats In reply to
Thank Alex,

I just changed your last line to read:

$description .= qq| NEW! | if ($row->{Has_New_Links} eq 'Yes');

and that works fine. Smile

Safe swoops
Sangiro