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

How To Modify this Global?

Quote Reply
How To Modify this Global?
I am using the following global for showing random links from random categories:

sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY RAND()', 'LIMIT 15');
my $sth = $table->select( { 'isValidated' => 'Yes', 'isSearchable' => 'Yes' } );
my @output;
while (my $link = $sth->fetchrow_hashref) {
$link->{Description};
push (@output, $link);
}
return { Random_Loop => \@output };
}

What do I need to change so it pulls only random links from a specific category in the detail page?

For example, in the detail page of a particular link, I want to show random links from the category the detail page link is in.