Hi,
I am using the below global to get the latest 8 links i the current category - how can I pass a specific category to is as <%category_link('x')%> where x is the ID of the category I want the latest links from?
my $tags = shift;
my $cat = $tags->{'Full_Name'};
my $output;
my $sth;
my $link;
use GT::SQL::Condition;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Add_Time DESC Limit 8');
$sth = $search_db->select (['Links.ID', 'Links.Description', 'Links.Title', 'Links.Add_Date', 'Links.isNew', 'Links.Image', 'Links.Story', 'Links.Add_Time', 'Links.Country', 'Category.Full_Name', 'Category.Name'], GT::SQL::Condition->new(['Full_Name', 'LIKE', $cat .'%'], ['isValidated', '=', 'Yes']));
my $output = qq~<br><hr>~;
while ($link = $sth->fetchrow_hashref)
{
# Set the category url
my $category_url = $CFG->{build_root_url}."/".$link->{'Full_Name'}."/";
# Set the detailed_url
my $detailed_url = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}
http://www.ameinfo.com
I am using the below global to get the latest 8 links i the current category - how can I pass a specific category to is as <%category_link('x')%> where x is the ID of the category I want the latest links from?
Code:
sub { my $tags = shift;
my $cat = $tags->{'Full_Name'};
my $output;
my $sth;
my $link;
use GT::SQL::Condition;
my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('ORDER BY Add_Time DESC Limit 8');
$sth = $search_db->select (['Links.ID', 'Links.Description', 'Links.Title', 'Links.Add_Date', 'Links.isNew', 'Links.Image', 'Links.Story', 'Links.Add_Time', 'Links.Country', 'Category.Full_Name', 'Category.Name'], GT::SQL::Condition->new(['Full_Name', 'LIKE', $cat .'%'], ['isValidated', '=', 'Yes']));
my $output = qq~<br><hr>~;
while ($link = $sth->fetchrow_hashref)
{
# Set the category url
my $category_url = $CFG->{build_root_url}."/".$link->{'Full_Name'}."/";
# Set the detailed_url
my $detailed_url = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}
http://www.ameinfo.com