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

Re: [antoined] random link on main page from a specified category

Quote Reply
Re: [antoined] random link on main page from a specified category In reply to
Try this global:

sub {
my ($output,$sth,$hash,$cond);
my $catid = $_[0];
my $limit = $_[1] || 4;
my $search_db = $DB->table('Links','CatLinks');
$search_db->select_options ("ORDER BY rand()", "LIMIT $limit");
my $all_ids = $DB->table('Category')->children($catid);
push @$all_ids, $catid;
$cond = GT::SQL::Condition->new('isValidated','=','Yes', 'CategoryID', 'IN', $all_ids);
$sth = $search_db->select ($cond);
while ($hash = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link_short', $hash);
}
return $output;
}
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Subject Author Views Date
Thread random link on main page from a specified category antoined 4925 Apr 12, 2005, 6:47 AM
Thread Re: [antoined] random link on main page from a specified category
antoined 4824 Apr 12, 2005, 8:39 AM
Thread Re: [antoined] random link on main page from a specified category
Andy 4849 Apr 12, 2005, 9:29 AM
Thread Re: [Andy] random link on main page from a specified category
antoined 4793 Apr 12, 2005, 9:43 AM
Thread Re: [antoined] random link on main page from a specified category
Andy 4789 Apr 12, 2005, 9:46 AM
Thread Re: [Andy] random link on main page from a specified category
antoined 4795 Apr 12, 2005, 9:58 AM
Thread Re: [antoined] random link on main page from a specified category
katabd 4739 Apr 12, 2005, 5:13 PM
Thread Re: [katabd] random link on main page from a specified category
antoined 4731 Apr 13, 2005, 4:46 AM
Post Re: [antoined] random link on main page from a specified category
katabd 4752 Apr 13, 2005, 6:43 AM
Post Re: [antoined] random link on main page from a specified category
Andy 4698 Apr 14, 2005, 1:41 AM
Post Re: [antoined] random link on main page from a specified category
afinlr 4696 Apr 14, 2005, 5:55 AM