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
Last 5 Comments Boxes
By bbatchel , Section Code []
Posted on Fri Feb 09, 2001 at 12:00:00 PM PST
Ok, again, I am posting code which I have written with the smaller scoop sites in mind. This is a box which shows the 5 most recent comments posted in the system...

I am teetering on whether or not to abandon this and go with a '5 most active articles' box. I don't know for sure yet.

Below is the code:

my $content;

my ($rv, $sth) = $S->db_select({
    WHAT => 'comments.sid, comments.cid, comments.pid, comments.subject',
    FROM => 'users, comments',
    WHERE => 'users.uid = comments.uid',
    ORDER_BY => 'date desc',
    LIMIT => '5'});

$content .= qq{<table border="0" cellpadding="0" cellspacing="0">};

while (my $user = $sth->fetchrow_hashref())
{
   $content .= qq{
      <tr><td valign="top" align="left"> |pil| </td>
                <td valign="top" align="left">|smallfont|
                <a href="|rootdir|/?op=comments;sid=$user->{sid};pid=$user->{pid};cid=$user->{cid}">$user->{subject}</a>
                |smallfont_end|
                </td>
       </tr>};
}

$content .= qq{</table>};

return {content => $content};
< An idea... | Editor Flag in Editorials >

Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Login
Make a new account
Username:
Password:

Related Links
· Scoop
· More on Boxes
· Also by bbatchel

Story Views
  22 Scoop users have viewed this story.

Display: Sort:
Last 5 Comments | 4 comments (4 topical, 0 hidden)
Why not both? (none / 0) (#1)
by mahonri on Sat Feb 10, 2001 at 09:00:28 AM PST

I am teetering on whether or not to abandon this and go with a '5 most active articles' box. I don't know for sure yet.

They're both great ideas. You could use both if you were so inclined. By all means, if you want to code a "5 most active articles" box, post it here. I will probably use this one until my site is more active, then possibly switch to the "5 most active articles" box (if you post one).
Thanks.



recent comment (none / 0) (#2)
by eric on Wed Feb 13, 2002 at 09:44:54 PM PST

recent comments with mod que support Here's an adaptation of the box above that checks for have_perm('moderate'). If a user is logged in, it shows comments in the queue. If not, it only shows ones in stories on the front page or in a section. Code:
my $content;

my $where;

# print comments for stories in the queue
# only if the user has moderate permission

if ($S->have_perm('moderate')) {
    $where = 'users.uid = comments.uid AND stories.sid=comments.sid';
}
else {
    $where = 'users.uid = comments.uid AND stories.sid=comments.sid AND stories.displaystatus >
-1';
}

# get the comments and their stories/authors

my ($rv, $sth) = $S->db_select({
    WHAT => 'comments.sid, comments.cid, comments.pid, comments.subject, users.nickname,
stories.title, stories.displaystatus',
    FROM => 'users, comments, stories',
    WHERE => $where,
    ORDER_BY => 'date desc',
    LIMIT => '10'});

$content .= qq{<table border="0" cellpadding="0" cellspacing="0">};

# print the stories

while (my $user = $sth->fetchrow_hashref()) {
   $content .= qq{
      <tr><td valign="top" align="left"> |pil| </td>
		<td valign="top" align="left">|smallfont||dot| <a
href="|rootdir|/comments/$user->{sid}/$user->{cid}#$user->{cid}">$user->{subject}</a>

<font size=-1>by $user->{nickname}</font>

<font size=-2>$user->{title} }; # print the "(queued)" for stories in the queue if ($user->{displaystatus} <0) { $content .= qq{(<em>queued</em>)}; } $content .= qq{</font> |smallfont_end| </td> </tr> }; } # end while $content .= qq{</table>}; return {content => $content};

Eric
ideas are masturbation get out get out get out



www.usacheckcashingstore.com/costa-mesa (none / 0) (#3)
by Pervez on Sat Apr 21, 2018 at 07:53:16 AM PST

This may be a superb web-site together with that I is unable to endorse everyone individuals a sufficient amount of. I absolutely delight in an individual's place. It's practical those consumers on line. Today follow-up www.usacheckcashingstore.com/costa-mesa Bless you meant for fine report.



kitchen remodeling nyc (none / 0) (#4)
by Pervez on Sun Apr 07, 2019 at 03:34:27 PM PST

Fantastic web site! Having chiropractic health! As I go together with one's specifics, love suitable for excellent information on chiropractic. Here follow-up kitchen remodeling nyc Most people just get pleasure from people superb truth love.



Last 5 Comments | 4 comments (4 topical, 0 hidden)
Display: Sort:

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