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
Changing a last five comments box from perl to Scoop box Boxes
By phill , Section Code []
Posted on Tue Aug 13, 2002 at 12:00:00 PM PST
I've been trying to mold scoop into a better version of what I wrote a while ago and I've hit a stump. Is there a scoop equivilant to this perl code? (it just takes the last 5 comments on a particular story and formats them for a box)

here is the code:

#!/usr/bin/perl -w
use strict;
use DBI;


# 2002/7/17/16823/3416
my $sid="2002/7/17/16823/3416";
my @com;
my $i=-1;
my $dbh = DBI->connect('DBI:mysql:generic_name', 'bling', 'word up is the codeword')
   or die "Couldn't open database: $DBI::errstr; stoppe d";

my $sth = $dbh->prepare("SELECT uid,comment FROM comments WHER E sid='$sid' ORD ER BY date DESC LIMIT 5")
   or die "Couldn't prepare statement: $DBI::errstr; st opped";
$sth->execute() or die "Couldn't execute statement: $DBI::errstr;&n bsp;stopped";
while ( my ($uid,$comment) = $sth->fetchrow_array() ) {
   $i++;
   my $sth2=$dbh->prepare("SELECT nickname FROM users WHE RE uid='$uid'")
      or die "Couldn't prepare statement: $DB I::errstr; stopped";
   $sth2->execute() or die "Couldn't execute statement:&n bsp;$DBI::errstr; sto pped";
   my $nickname=$sth2->fetchrow_array();
   $comment=~s/<br>//gi;
   $comment=~s/<p>//gi;
   $com[$i]="(<a href=\"http://www1.pipebox.net/user/$nickname\">$nickname </a>) $comment& lt;br><br>";
}
$dbh->disconnect;
while($i>=0){
   print "$com[$i]\n";
   $i--;
}
print "[ <a href=\"/comments/2002/7/17/16823/3416/0/post#here\">comment</a&g t;& nbsp;]\n";
exit;


And while it may not be pretty, it sure gets the job done. I tried to do something similar to this using the exisiting boxes as a guide but it didn't work.

Any tips?

< Are There Any Sexual Scoop Sites? | Scoop Hosting >

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 phill

Story Views
  26 Scoop users have viewed this story.

Display: Sort:
Changing a last five comments box from perl to Scoop box | 5 comments (5 topical, 0 hidden)
you might have already looked (none / 0) (#1)
by janra on Wed Aug 14, 2002 at 08:25:19 AM PST

but did you try the existing "last 5 comments" box, and add a "WHERE" on the select?


--
Discuss the art and craft of writing




Thanks (none / 0) (#3)
by jacksmith on Tue Jan 07, 2014 at 12:37:30 AM PST

I'm well aware that people have testinside HP2-H28 asked to get some kind of a notification on replies to their comments, however, I'm not sure as to how interested you people are in trying to implement this. HP2-H28 exam



Payday Loans Costa-mesa (none / 0) (#4)
by Pervez on Sun Apr 08, 2018 at 09:40:24 PM PST

Truly decent piece of writing! A piece of writing is really advantageous regarding Western say not to mention quite a lot of some people to edit. Equipped toil will be able altogether bring back within your websites for the purpose of spare items. Nowadays then click Payday Loans Costa-mesa Thanks a lot for the purpose of decent piece of writing.



best bathroom remodeling queens (none / 0) (#5)
by Pervez on Sun Mar 24, 2019 at 02:32:35 PM PST

Really fascinating! I'm usually searching on the internet with regard to content articles that will help me personally. There's certainly a great deal to understand relating to this, I believe a person created good quality factors within functions additionally. Right now, follow-up best bathroom remodeling queens That's something genuinely incredible.



Changing a last five comments box from perl to Scoop box | 5 comments (5 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