I just ran into a small problem with the cat_sponsor global.
On the root category it displays 19 links and all subcats display 9. It is set to LIMIT 10 so I have no clue why this is happening.
It is also repeating links too. The exact same link was displayed 3 times in the list of sponsors. Is there a way to get it to stop listing the same link multiple times?
sub {
# Displays the sponsored links on every page.
my ($output,$sth,$link,$cond);
my $catid = shift;
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;
}
On the root category it displays 19 links and all subcats display 9. It is set to LIMIT 10 so I have no clue why this is happening.
It is also repeating links too. The exact same link was displayed 3 times in the list of sponsors. Is there a way to get it to stop listing the same link multiple times?
sub {
# Displays the sponsored links on every page.
my ($output,$sth,$link,$cond);
my $catid = shift;
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;
}