Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [t7o7n7y] "newest links"

Quote Reply
Re: [t7o7n7y] "newest links" In reply to
Hi,

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
Subject Author Views Date
Thread "newest links" t7o7n7y 4176 Apr 7, 2003, 5:58 AM
Thread Re: [t7o7n7y] "newest links"
Andy 4102 Apr 7, 2003, 6:39 AM
Thread Re: [Andy] "newest links"
t7o7n7y 4118 Apr 7, 2003, 8:45 AM
Thread Re: [t7o7n7y] "newest links"
klauslovgreen 4086 Apr 7, 2003, 9:13 AM
Thread Re: [klauslovgreen] "newest links"
t7o7n7y 4074 Apr 7, 2003, 9:35 AM
Post Re: [t7o7n7y] "newest links"
klauslovgreen 4053 Apr 7, 2003, 10:48 AM