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

Products: Gossamer Links: Development, Plugins and Globals: Re: [rascal] Should it be in a Loop: Edit Log

Here is the list of edits for this post
Re: [rascal] Should it be in a Loop
Try;

Code:
sub {

my ($id,$search_db,$output,$sth,$link,@links);
$id = shift;
$search_db = $DB->table('Links','CatLinks');
$search_db->select_options ("ORDER BY rand()") || return $GT::SQL::error;
$sth = $search_db->select ({xxx => 'Yes', isValidated => 'Yes', CategoryID=>$id}) || return $GT::SQL::error;
while ($link = $sth->fetchrow_hashref) {
push @links, $link;
}
return { rand_links_loop => \@links };
}

..and then you should be able to call it with;

Code:
<%global_name($ID)%>

<%if rand_links_loop%>
<h1>Random Links</h1>
<%loop rand_links_loop%>
<include link.html%>
<%endloop%>
<%endif%>

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!

Last edited by:

Andy: Mar 14, 2005, 11:21 PM

Edit Log: