Hi,
This global gives a random link according to the category number given in 'my $cat_id'
This works fine but I wondered if any cleaver programmers can make this give the random link from the top category listed and its subcategories. As it is, it only gives the random link from the 1 category listed.
sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = 1;
my $limit = $tags->{Random_Limit} || 1;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
$sth = $link_db->select ( { CategoryID => $cat_id });
while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}
return { Random_Loop => \@output }
}
--------------------------------
Privacy Software
This global gives a random link according to the category number given in 'my $cat_id'
This works fine but I wondered if any cleaver programmers can make this give the random link from the top category listed and its subcategories. As it is, it only gives the random link from the 1 category listed.
sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = 1;
my $limit = $tags->{Random_Limit} || 1;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
$sth = $link_db->select ( { CategoryID => $cat_id });
while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}
return { Random_Loop => \@output }
}
--------------------------------
Privacy Software