Hi,
This global called 'newlinks' could do the trick:
lib->import('Path/to/admin'); # might not be necessary
require GT::SQL;
my $table = GT::SQL->new('/path/to/admin/defs')->table('Links');
$table->select_options ('ORDER BY Add_Date DESC', 'LIMIT 5');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top5_loop => \@output };
}
Then insert the following in the template where you want the latest 5 links to appear:
<%loop top5_loop%>
<%Title%>
<%endloop%>
Cheers
Klaus
http://www.ameinfo.com
This global called 'newlinks' could do the trick:
Code:
sub { lib->import('Path/to/admin'); # might not be necessary
require GT::SQL;
my $table = GT::SQL->new('/path/to/admin/defs')->table('Links');
$table->select_options ('ORDER BY Add_Date DESC', 'LIMIT 5');
my $sth = $table->select;
my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { top5_loop => \@output };
}
Then insert the following in the template where you want the latest 5 links to appear:
Code:
<%newlinks%> <%loop top5_loop%>
<%Title%>
<%endloop%>
Cheers
Klaus
http://www.ameinfo.com