View Full Version : Paragraph breaks in a textarea for blog
06-14-2005, 07:00 PM
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?
06-14-2005, 07:09 PM
try inputing "<br>" see if that is what you want
06-14-2005, 07:12 PM
No, I want it to be automatic so the user doesn't have to know any special HTML tags.
06-14-2005, 07:18 PM
do a replace than every time they do return it should normally put in a /n just get it to replace /n with <br>
06-14-2005, 07:30 PM
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?
06-14-2005, 08:21 PM
06-14-2005, 09:03 PM
nl2br() function replaces all of your newlines with a <br />\n. This is probably what you are looking for.
06-15-2005, 06:14 AM
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 ...
06-15-2005, 06:16 AM
06-15-2005, 07:25 AM
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.
06-15-2005, 07:36 AM
Ok, where you display your blog posts use this code:
echo nl2p($blogpost, true);
I thought it was kind of obvious.
06-15-2005, 07:39 AM
But where do I put the plugin info? In another script and require it?
06-15-2005, 09:28 AM
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.
06-15-2005, 11:14 PM
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).
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.