You could try something like;
my $db = $DB->table('CatLinks','Links');
my (@output, $sth);
my $count = 0;
my $sth = $db->select ( { CategoryID => $_[0]}, { Link_Type => 'Premium' } );
while (my $hash = $sth->fetchrow_hashref) {
if ($count == 1) { $count = 0; $hash->{odd} = 1; }
if ($count == 0 && !$hash->{odd}) { $count++; $hash->{even} = 1; }
push @output, $hash;
}
return { Premium_Link_Loop => \@output }
}
...called with;
<%loop Premium_Link_Loop%>
<%include link.html%>
<%endloop%>
...and then in link.html, you can use;
<%if odd%>foo<%else%><%endif%>
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!
Code:
sub { my $db = $DB->table('CatLinks','Links');
my (@output, $sth);
my $count = 0;
my $sth = $db->select ( { CategoryID => $_[0]}, { Link_Type => 'Premium' } );
while (my $hash = $sth->fetchrow_hashref) {
if ($count == 1) { $count = 0; $hash->{odd} = 1; }
if ($count == 0 && !$hash->{odd}) { $count++; $hash->{even} = 1; }
push @output, $hash;
}
return { Premium_Link_Loop => \@output }
}
...called with;
Code:
<%global_name%> <%loop Premium_Link_Loop%>
<%include link.html%>
<%endloop%>
...and then in link.html, you can use;
<%if odd%>foo<%else%><%endif%>
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!