Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape Paragraph breaks in a textarea for blog

    I'm currently designing a blog entry interface. When I enter a new blog entry in a textarea, I naturally hit return when I want to start a new paragraph. However, when the text is published it comes out as one big paragraph.

    What do I need to do to fix this so that PHP/MySQL automatically realizes new paragraphs?

    Thanks,

    Eric

  • #2
    Regular Coder
    Join Date
    Dec 2004
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try inputing "<br>" see if that is what you want

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, I want it to be automatic so the user doesn't have to know any special HTML tags.

  • #4
    Regular Coder
    Join Date
    Dec 2004
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do a replace than every time they do return it should normally put in a /n just get it to replace /n with <br>

  • #5
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you explain in better detail? I'm kind of a n00b.

    To clarify, I want this to automated. I don't want to have to go in and do a find and replace. Isn't that the value of PHP?

    Thanks,

    Eric
    Last edited by grubesteak; 06-14-2005 at 07:13 PM.

  • #6
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    nl2br() function replaces all of your newlines with a <br />\n. This is probably what you are looking for.

  • #8
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I love the idea of this, but I have no idea where (or how) I would implement? Any input? I feel like I'm close ...

    thanks!

  • #9
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    nl2p($blogpost, true);

  • #10
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down

    I guess I haven't made myself clear. I'm wanting a tad bit more descriptive answer.

    If you can't offer something more descriptive, I'd rather you not post a reply at all.
    Last edited by grubesteak; 06-15-2005 at 06:30 AM.

  • #11
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok, where you display your blog posts use this code:

    echo nl2p($blogpost, true);

    I thought it was kind of obvious.

  • #12
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts
    But where do I put the plugin info? In another script and require it?

  • #13
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have a file dedicated to stand alone functions. I then require that file into my header files which are required into every page that needs them.

  • #14
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macintosh

    I guess I just can't figure the plugin thing out. thanks anyway.

    I did manage to figure out the nl2br function, although it's not quite what I want (but I'll take it for now).

    Thanks!
    Last edited by grubesteak; 06-15-2005 at 10:29 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •