Gossamer Forum
Home : General : Perl Programming :

Simple News/Article Perl Script Needed

Quote Reply
Simple News/Article Perl Script Needed
Does anyone know of a script like this:

-----------

Name [textbox]
Article title [textbox]
Article [textarea]

Publish [button]

--------------

articles appear here along with the date they were entered.

---------
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
<iframe></iframe>
<ilayer></ilayer>

Basically, to have everything appear on the "same" page, you would have to use either frames with different windows, or embedded "frames" via IFRAME/ILAYER.

Regards,

Eliot Lee
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
I think you misunderstood what I was saying Eliot. I'm looking for a script that does what I showed in my first message in this thread.

Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
I could make that for you if you want....let me know via pm or email.

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
NewsPro: http://amphibian.gagames.com/newspro/

More at:
http://cgi.resourceindex.com/...s/Perl/News_Posting/

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
And again, to show results in the same page where the form is located dynamically, like refreshing the news articles...you will need to use javascript...

Your example was confusing....

You should've showed something like:

Code:

NEWS SEARCH FORM (PAGE 1)
Name: [textbox]
Article title: [textbox]
Article [textarea]
Publish [button]


Code:

NEWS RESULTS (Page 2)

NEWS ARTICLE


Regards,

Eliot Lee
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
I've actually had a look there but they all require you to have a username and password which I don't want.

I just want this to all be on one page where anyone can enter an article.

Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
Sorry Eliot... I want it all on one page:


NEWS SEARCH FORM (PAGE 1)

Name: [textbox]
Article title: [textbox]
Article [textarea]

Publish [button]

-------

NEWS RESULTS (Still Page 1)

news articles


Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
Something like NewsPro could easily be modified to display the form and news on the same page.

As for usernames/passwords, you could simply embed them in the form with hidden fields.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
For you maybe Blush

Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
As I said I would do this for you.....ah well.......

.....Eliot: You don't need javascript if it is written in cgi - I have written a guestbook that currently uses two pages but can be easily modified to use just one without the need for javascript. You just need to call the main sub again after the form is processed and then have some code to read from the database like....

sub main {

print "Content-type: text/html\n\n";
print qq|
MY MAIN PAGE IS HERE

|;

open(DB,"db.txt") || die "Can't open db:$!";
@stuff=<DB>;
close(DB);

foreach $line (@stuff) {
chomp $line;
print $line;
}

print qq|
END OF MAIN PAGE!
|;
}

Then somewhere on this main page you'd have the form which would be processed by another sub and then sub main would be called again at the end to bring you back to the main page.

eg..

sub process_form {

do the processing....

main();

}

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
Thanks Paul Smile

Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
Well, it was not well-explained as to the end-goal of the request. Wink

Regards,

Eliot Lee
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
When were you thinking of doing this for me Paul?



Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
I've come across this script http://www.stefan-pettersson.nu/scripts/oneliner/ called Oneliner. It's near on perfect for what I want to do except it doesn't do word wrapping. I've setup it up here http://server5.hypermart.net/...lark/bulletin_board/ and have changed the textbox to a textarea so articles can be inserted but it doesn't word wrap entries, e.g if you enter:

line 1
line 2
line 3

it appears as line 1 line 2 line 3

Is there a simple solution to this?

The code can either be viewed here http://server5.hypermart.net/...n_board/oneliner.txt or at the offical website shown above.

Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
Try this (take the space out of the br tag though...):
Code:
sub getEntry {
my $text;
$in{'msg'} =~ s/\n/<b r>/g;

# If you want to change the look of how an oneliner entry looks like,
# besides changing the variables available at the top of this file,
# then this is the place to modify.

$text .= '<tr bgcolor="' . $bgcolor . '">';
$text .= '<td align=left nowrap>' . $font_date . &GetDateString . '</font></td>';
$text .= '<td align=left nowrap>' . $font_msg . $in{'msg'} . '</font></td>';
$text .= '<td align=right nowrap>' . $font_who . $in{'who'} . '</font></td>';
$text .= "</tr>\n";
}
I added an item to the script, hope you don't mind Smile

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
Oh you rock Mark!!! Smile Thanks again for about the 100th time!!! Laugh

In Reply To:
I added an item to the script, hope you don't mind
Of course I don't mind. Word wrapping is working fine now which is exactly what I wantedSmile

Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
.........and for future reference.....

$in{'msg'} =~ s/\n/<b r>/g;

\n stands for a newline.
<b r> is obviously a line break tag.

So all that code is doing is replacing new lines with br tags for html presentation.

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Simple News/Article Perl Script Needed In reply to
ok thanks.