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 6070 Mar 7, 2004, 11:59 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 5995 Mar 7, 2004, 5:01 PM
Thread Re: [afinlr] Category Sponsor Question
craven32 6041 Mar 7, 2004, 5:48 PM
Thread Re: [craven32] Category Sponsor Question
afinlr 5935 Mar 8, 2004, 5:15 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 5923 Mar 8, 2004, 9:17 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 5921 Mar 8, 2004, 9:22 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 5932 Mar 8, 2004, 9:46 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 5887 Mar 8, 2004, 10:03 AM
Post Re: [afinlr] Category Sponsor Question
craven32 5896 Mar 8, 2004, 10:15 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 5901 Mar 8, 2004, 10:35 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 5901 Mar 8, 2004, 10:44 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 5876 Mar 8, 2004, 11:28 AM
Thread Re: [craven32] Category Sponsor Question
afinlr 5886 Mar 8, 2004, 11:46 AM
Thread Re: [afinlr] Category Sponsor Question
craven32 5882 Mar 8, 2004, 11:52 AM
Post Re: [craven32] Category Sponsor Question
afinlr 5842 Mar 8, 2004, 12:27 PM
Post Re: [craven32] Category Sponsor Question
Andy 5922 Mar 8, 2004, 12:27 AM