[thelist] simple string manipulation...

John Corry webshot at neoncowboy.com
Wed May 9 14:02:17 CDT 2001

I have a field in a database that is going to hold text. Specifically: 2-3
paragraphs of text.

I need to come up with a way to output that text into <p> tags (using
PHP)...but I'm not sure how to approach it:

Do I try to create a variable that contains each paragraph (by getting a sub
string that contains everything up to the first hard return)?


Do I replace all hard returns with </p><p>...and write that into a <p>
block, where my opening and closing <p> tags are hard coded into the output?


How do you masters of this stuff handle outputting a variable length amount
of text as HTML paragraphs. I'm trying to avoid storing HTML in my database,
even though just storing the text as HTML (with nothing more than <p> and
<a> tags allowed) would be pretty easy.

thanks if you can help...

More information about the thelist mailing list