Gossamer Forum
Home : Products : Gossamer Links : Discussions :

subcategory_links order output

Quote Reply
subcategory_links order output
Using the sub subcategory_links. The sub lists all links at higher category levels. How do I control the order that the links are listed. For example, 'ORDER BY Add_Date DESC'.

sub {
my $output;
my $tags = shift;
return '' unless ($tags->{ShowSubCategoryLinks});
my $cat_id = $tags->{ID};
my $subcats = $DB->table('Category')->children($cat_id);
push @$subcats, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', \@$subcats);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link)
}
return $output;
}

Thanks
Quote Reply
Re: [OP] subcategory_links order output In reply to
Should be able to just replace;

Code:
my $link_db = $DB->table('Links','CatLinks');

with

Code:
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options('ORDER BY Add_Date','LIMIT 5');

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!