hi
To get some random links on my detailed page, I have created the following global :
sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = $tags->{Random_CatID};
my $limit = $tags->{Random_Limit} || 5;
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 }
}
then I include it on my detailed page via the following code :
<%set Random_CatID = $CategoryID%>
<%random_links%>
<%loop Random_Loop%>
<li><b><%Title%></b></li>
<%endloop%>
What I would like to do is to add a new condition, I want to loop to be done only on validated links (something like where validated="yes")
txs for your help
Regards
FMP
To get some random links on my detailed page, I have created the following global :
sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = $tags->{Random_CatID};
my $limit = $tags->{Random_Limit} || 5;
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 }
}
then I include it on my detailed page via the following code :
<%set Random_CatID = $CategoryID%>
<%random_links%>
<%loop Random_Loop%>
<li><b><%Title%></b></li>
<%endloop%>
What I would like to do is to add a new condition, I want to loop to be done only on validated links (something like where validated="yes")
txs for your help
Regards
FMP