Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Top 10 Top Rated By Category

Quote Reply
Top 10 Top Rated By Category
I found a lot of posts by searching covering this topic but no real answers. I found a few globals that were close but no cigar!

I want to display the Top Rated sites listed in a root category and all it's sub categories on the root category page.

Thanks,

Craven
Quote Reply
Re: [craven32] Top 10 Top Rated By Category In reply to
Something like this:

sub {
my ($all_ids,@list,$output);
my $tags = shift;
my $cat_id = $tags->{ID};
$all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options ('ORDER BY Rating DESC LIMIT 10');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~<li><a href="$CFG->{db_cgi_url}/jump.cgi?ID=$link->{ID}">$link->{'Title'}</a>~;
}
return $output;
}