Hi,
Untested, but give this a go:
get_latest_forum
my $path = '/path/to/gforum/admin/defs';
my $NEWDB = new GT::SQL (
def_path => $path,
cache => 0,
debug => 0,
subclass => 1
);
my $tbl = $NEWDB->table('Post');
$tbl->select_options("ORDER BY post_time DESC LIMIT 10");
my @loop;
my $sth = $tbl->select() || die $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
return { latest_forum_posts => \@loop }
}
<ul>
<%loop latest_forum_posts%>
<li><a href="/cgi-bin/gforum/gforum.cgi?post=<%post_id%>"><%post_subject%></a></li>
<%endloop%>
</ul>
Thats all the time I can spare with that. Hopefully it works ;)
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!
Untested, but give this a go:
get_latest_forum
Code:
sub { my $path = '/path/to/gforum/admin/defs';
my $NEWDB = new GT::SQL (
def_path => $path,
cache => 0,
debug => 0,
subclass => 1
);
my $tbl = $NEWDB->table('Post');
$tbl->select_options("ORDER BY post_time DESC LIMIT 10");
my @loop;
my $sth = $tbl->select() || die $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}
return { latest_forum_posts => \@loop }
}
Code:
<%get_latest_forum%> <ul>
<%loop latest_forum_posts%>
<li><a href="/cgi-bin/gforum/gforum.cgi?post=<%post_id%>"><%post_subject%></a></li>
<%endloop%>
</ul>
Thats all the time I can spare with that. Hopefully it works ;)
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!