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

Products: Gossamer Links: Development, Plugins and Globals: Category Sponsor Question: Edit Log

Here is the list of edits for this post
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

Edit Log: