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

Slight alteration needed.

Quote Reply
Slight alteration needed.
Code:
sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = $tags->{Random_CatID};
my $limit = $tags->{Random_Limit} || 3;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
if ($cat_id) {
$sth = $link_db->select ( { CategoryID => $cat_id });
}
else {
$sth = $link_db->select;
}while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}return { Random_Loop => \@output }
}


The above is a global that displays random links. I need for it to only display validated ones. Can anyone help?

cdkrg

Able2Know :: Ajooja Directory
Quote Reply
Re: [cdkrg] Slight alteration needed. In reply to
You could try;

$sth = $link_db->select ( { CategoryID => $cat_id }, { isValidated => 'Yes' });

This is on 2.1.2, but 2.2 will require it a little differently (not sure on the definate format, but its something like the below);

$sth = $link_db->select ( { CategoryID => $cat_id }, { VIEWABLE });

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!