Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

New posts in a category

Quote Reply
New posts in a category
I'm using this global to show new posts in a category on my LinksSQL pages but I'd like to know how to change the lines in red to get an arrayref of the ids of the subcategories (so that I can include posts from subcategories in the global). In LinksSQL I would just use $obj->children($id) but this doesn't seem to work in GForum and I don't quite understand the tree structure yet.

sub {
#first get category id
my $forum_id = shift;
use lib('/path/to/forum/admin');
my $relation = GT::SQL->new('/home/sites/home/web/perl/forum/admin/defs')->table('Forum','Post');
#my $tree = GT::SQL->new('/path/to/forum/admin/defs')->table('Category')->tree;
#my $all_ids = $tree->children(id=>$forum_id);

$relation->select_options ('ORDER BY post_time DESC','LIMIT 10');
my $cond = GT::SQL::Condition->new( 'cat_id_fk', '=', "$forum_id");
my $sth = $relation->select($cond);
use GForum::Convert;
my $output;
while (my $post = $sth->fetchrow_hashref){
my $subject = $post->{post_subject};
my $post_user = $post->{post_username};
convert_markup(\$subject);
$output.=qq~<li><a href=".....$post->{post_id}"><b>$subject</b></a><br>~;
}
return $output;
}
Subject Author Views Date
Thread New posts in a category afinlr 1517 Mar 30, 2004, 3:33 PM
Post Re: [afinlr] New posts in a category
afinlr 1423 Apr 2, 2004, 8:54 AM