...

View Full Version : Paragraph breaks in a textarea for blog



grubesteak
06-14-2005, 06: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?

Thanks,

Eric

Kura_kai
06-14-2005, 06:09 PM
try inputing "<br>" see if that is what you want

grubesteak
06-14-2005, 06:12 PM
No, I want it to be automatic so the user doesn't have to know any special HTML tags.

Kura_kai
06-14-2005, 06: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>

grubesteak
06-14-2005, 06: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?

Thanks,

Eric

Kurashu
06-14-2005, 07:21 PM
http://smarty.incutio.com/?page=ParagraphPlugin

Fou-Lu
06-14-2005, 08:03 PM
nl2br() function replaces all of your newlines with a <br />\n. This is probably what you are looking for.

grubesteak
06-15-2005, 05:14 AM
http://smarty.incutio.com/?page=ParagraphPlugin

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!

Kurashu
06-15-2005, 05:16 AM
nl2p($blogpost, true);

grubesteak
06-15-2005, 06: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.

Kurashu
06-15-2005, 06:36 AM
Ok, where you display your blog posts use this code:

echo nl2p($blogpost, true);

I thought it was kind of obvious.

grubesteak
06-15-2005, 06:39 AM
But where do I put the plugin info? In another script and require it?

Kurashu
06-15-2005, 08: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.

grubesteak
06-15-2005, 10: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).

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum