Hi,
It should be as simple as a new global:
Code:
sub get_top_rated {
my $links = $DB->table('Links');
require GT::SQL::Condition;
my $cond = GT::SQL::Condition->new('Votes', '>=', 10, VIEWABLE);
$GRAND_TOTAL ||= _grand_total();
$links->select_options("ORDER BY Rating DESC", "LIMIT 10");
my $rated = $links->select($cond);
$links->select_options("ORDER BY Votes DESC", "LIMIT 10");
my $voted = $links->select($cond);
my (@top_votes_loop, @top_rated_loop);
while (my $link = $voted->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_detail_url} . '/' . $links->detailed_url($link->{ID}) if $CFG->{build_detailed};
push @top_votes_loop, $link;
}
while (my $link = $rated->fetchrow_hashref) {
$link->{detailed_url} = $CFG->{build_detail_url} . '/' . $links->detailed_url($link->{ID}) if $CFG->{build_detailed};
push @top_rated_loop, $link;
}
# And write it to a file.
return Links::SiteHTML::display(rate_top => {
top_rated_loop => \@top_rated_loop,
top_votes_loop => \@top_votes_loop
});
}
Call with:
Code:
<%global_name%>
<%loop top_rated_loop%>
<%include link.html%>
<%endloop%>
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!