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

Category Sponsor Question

Quote Reply
Category Sponsor Question
I'm using this global to display my sponsor links for each category

<%cat_sponsor%>

sub {
# Displays the sponsored links on every page.
my ($output,$sth,$link,$cond);
my $tags=shift;
my $catid = $tags->{'category_id'};
my $search_db = $DB->table('Links','CatLinks');
$search_db->select_options ("ORDER BY rand()", "LIMIT 10");
if ($catid){
my $cat_db = $DB->table('Category');
my $all_ids = $cat_db->children($catid);
push @$all_ids, $catid;
$cond = GT::SQL::Condition->new('Sponsor', '=', 'Yes', 'isValidated','=','Yes', 'CategoryID', 'IN', $all_ids);
}
else {
$cond = GT::SQL::Condition->new('Sponsor', '=', 'Yes', 'isValidated','=','Yes');
}
$sth = $search_db->select ($cond);
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('linktop10', $link);
}
return $output;
}

How can I get this to display only certain categories and their sub categories? Is there an easy way to do this?

I tried this <%cat_sponsor (153)%> thinking it may work but only got errors. What I wanted was the category with ID 153 and all of it's sub cats sponsors displayed so I could add the global to every subcat page. That way when there is only a link or 2 it doesn't look so bad

Thanks,

Craven

Last edited by:

craven32: Mar 7, 2004, 12:05 PM
Subject Author Views Date
Thread Category Sponsor Question craven32 3387 Mar 7, 2004, 11:59 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 3355 Mar 7, 2004, 5:01 PM
Thread Re: [afinlr] Category Sponsor Question
craven32 3372 Mar 7, 2004, 5:48 PM
Thread Re: [craven32] Category Sponsor Question
afinlr 3293 Mar 8, 2004, 5:15 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 3272 Mar 8, 2004, 9:17 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 3277 Mar 8, 2004, 9:22 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 3275 Mar 8, 2004, 9:46 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 3253 Mar 8, 2004, 10:03 AM
Post Re: [afinlr] Category Sponsor Question
craven32 3247 Mar 8, 2004, 10:15 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 3258 Mar 8, 2004, 10:35 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 3243 Mar 8, 2004, 10:44 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 3232 Mar 8, 2004, 11:28 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 3244 Mar 8, 2004, 11:46 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 3236 Mar 8, 2004, 11:52 AM
Post Re: [craven32] Category Sponsor Question
afinlr 3212 Mar 8, 2004, 12:27 PM
Post Re: [craven32] Category Sponsor Question
Andy 3291 Mar 8, 2004, 12:27 AM