Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: recent_comments 1.00

Author: theantix [Info]

Description:

Simply returns a list of the recent comments, useful for sites with low traffic. Based on recent_diaries by Steve Linberg.

Box Code:

my $content;
my $num_comments = 10;
my $trim_length = 45;

# Get the last $num_comments comments
my ($rv, $sth) = $S->db_select({
WHAT => 'U.nickname, C.subject, C.cid, C.sid',
FROM => 'comments C, users U',
WHERE => 'U.uid=C.uid',
ORDER_BY => 'date DESC',
LIMIT => $num_comments});

my $table = $sth->fetchall_arrayref;

my ($nickname, $subject, $cid, $sid);
for (@$table) {
($nickname, $subject, $cid, $sid) = @$_;

# trim the subject line if it is too long
if (length $subject > $trim_length) {
$title = substr($subject, 0, $trim_length);
$title =~ s/\s+\S+$//;
$title .= '...';
}

$content .= qq{
|dot| <A HREF="|rootdir|/comments/$sid/$cid#$cid">$subject</a> ($nickname)<BR>
};
}

# And return the content, like normal.
return $content;
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
The OpenNIC
Democratically operated Domain Name System; using Scoop since Jan. 2001.

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search