Hi,
How to show the total of new links based on specific category? Currently i'm using the tag below to show overall total link:
sub {
$DB->table('Links')->count( { isNew => 'Yes' } )
}
I think its maybe something it can be done by using tag below:
sub {
my ($all_ids,@list);
my $cat_id = '243';
$all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY Add_Date DESC LIMIT 10");
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', \@$all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 36) {
$link->{Title} = substr($link->{Title}, 0, 36) . '...';
}
push @list, $link;
}
my $output;
foreach my $link (@list) {
# Set the category url
my $url = $DB->table('Category')->as_url($link->{'Full_Name'});
# Set the detailed_url
my $detailed_url = "$CFG->{build_detail_url}/$link->{'LinkID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display ('lastlinks', $link);
}
return $output;
}
Please help.
How to show the total of new links based on specific category? Currently i'm using the tag below to show overall total link:
Code:
totalnew: sub {
$DB->table('Links')->count( { isNew => 'Yes' } )
}
I think its maybe something it can be done by using tag below:
Code:
lastlinks: sub {
my ($all_ids,@list);
my $cat_id = '243';
$all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY Add_Date DESC LIMIT 10");
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', \@$all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 36) {
$link->{Title} = substr($link->{Title}, 0, 36) . '...';
}
push @list, $link;
}
my $output;
foreach my $link (@list) {
# Set the category url
my $url = $DB->table('Category')->as_url($link->{'Full_Name'});
# Set the detailed_url
my $detailed_url = "$CFG->{build_detail_url}/$link->{'LinkID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display ('lastlinks', $link);
}
return $output;
}
Please help.