Adding <br> automatically with "return" key ?

Discussion in 'Perl' started by Jimbo, Apr 7, 2005.

  1. Jimbo

    Jimbo Guest

    Hello,

    I'm not a perl programmer but I can kind of hack my way through some
    simple scripts. What I am trying to do is get it so a line break <br> is
    automatically placed when I hit the return key in a text box in this
    script:
    http://mosaikum.org/sonst/pws.html

    It will add the <br> automatically to the Add Story function, but not
    the edit text function. I'm trying to get it to do it in the edit
    function as well.

    It looks like here's the bit of code that does it for the "Add Story"

    if ($ueberschrift) {
    $ueberschrift = "<br><b>".$ueberschrift."</b>";
    $ueberschrift .= "\n";
    }

    $ueberschrift .= "<br>\n";
    if ($linebreaks eq "yes") {
    $text =~ s/\n/<br>\n/g;
    }

    I've tried adding that to this:

    sub Bearb {

    if (($filename =~ m/[^\w\.\-_]/i) or (not($filename =~ m/\.txt$/)) )
    {$filename=""; $showerror='Error in Filename! Use only numbers, letters,
    "_" and "-". <br> File MUST end with .txt'; &Auswahl; return;}

    $title="Editing $filename";
    open (WISHANDLE, "$filename");
    while ($wisline = <WISHANDLE>) {
    $wisvar .= $wisline;
    }

    close (WISHANDLE);
    print qq!

    but, since I don't know what I'm doing, it, understandably, didn't work.


    Any info (i.e. something I can copy and paste) on this would be much
    appreciated.

    Thanks
    Jimbo, Apr 7, 2005
    #1
    1. Advertising

  2. Jimbo

    Jimbo Guest


    > Any info (i.e. something I can copy and paste) on this would be much
    > appreciated.
    >
    > Thanks


    Never mind... I figured it out.
    Jimbo, Apr 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF1bA==?=
    Replies:
    3
    Views:
    388
    =?Utf-8?B?UGF1bA==?=
    Oct 14, 2005
  2. Greenhorn
    Replies:
    15
    Views:
    812
    Keith Thompson
    Mar 6, 2005
  3. M P
    Replies:
    1
    Views:
    466
  4. PerlFAQ Server
    Replies:
    0
    Views:
    151
    PerlFAQ Server
    Jan 24, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    119
    PerlFAQ Server
    Feb 20, 2011
Loading...

Share This Page