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

Products: Gossamer Links: Development, Plugins and Globals: Re: [Evoir] Random Links Specified Per Category (continued ... ): Edit Log

Here is the list of edits for this post
Re: [Evoir] Random Links Specified Per Category (continued ... )
What you could do is alter it to:

Code:

sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = Your Category ID here;
my $limit = $tags->{Random_Limit} || 3;
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 }
}

Then just substitute the bold bit with the category id you want to pull from.

Last edited by:

RedRum: Dec 26, 2001, 1:20 PM

Edit Log: