I use this Global to show new link of category
sub {
my $cat = $_[0];
my ($output,$sth,$link);
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 10');
$sth = $search_db->select (['Links.*'], GT::SQL::Condition->new(['CategoryID', 'IN', $all_ids], ['isValidated', '=', 'Yes', 'isNew', '=', 'Yes']) );
my $seen;
my $output;
while ($link = $sth->fetchrow_hashref)
{
if ($seen->{$link->{$id}}) { next }
my $category_url = $CFG->{build_root_url}."/".$link->{'Full_Name'}."/";
my $detailed_url = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display('sortlink', $link);
$seen->{$link->{$id}} = 1;
}
return $output;
}
Can I make the output send in a Loop - something like
<%loop new_link%>
-----------------
<%endloop%>
sub {
my $cat = $_[0];
my ($output,$sth,$link);
my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 10');
$sth = $search_db->select (['Links.*'], GT::SQL::Condition->new(['CategoryID', 'IN', $all_ids], ['isValidated', '=', 'Yes', 'isNew', '=', 'Yes']) );
my $seen;
my $output;
while ($link = $sth->fetchrow_hashref)
{
if ($seen->{$link->{$id}}) { next }
my $category_url = $CFG->{build_root_url}."/".$link->{'Full_Name'}."/";
my $detailed_url = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display('sortlink', $link);
$seen->{$link->{$id}} = 1;
}
return $output;
}
Can I make the output send in a Loop - something like
<%loop new_link%>
-----------------
<%endloop%>