Gossamer Forum
Quote Reply
category of random link
Hi everyboby

I am using this global to display random links of cats and subcats

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', 'isNew', '=', 'Yes', 'CategoryID', 'IN', $all_ids);
$sth = $search_db->select ($cond);
while ($hash = $sth->fetchrow_hashref) { push @output, $hash;}
return \@output;

i also want to display the Name of the cat and the link to the cat of the random link

Please help