[thelist] Formatted text in MySQL text field

Beau Hartshorne beau at hartshorne.ca
Tue Oct 7 20:10:06 CDT 2003


Ken,

You need to write a function that detects text paragraphs usually
delimited by two newlines and converts them to HTML paragraphs delimited
by <p> and </p>. You will also want to convert all single newlines to
<br />.

So a mysql text field like this:

Para1
Line2

Para2

Will be converted to:

<p>Para1<br />
Line2</p>

<p>Para2</p>

Someone posted a function like this to the php manual:

http://ca.php.net/nl2br

(look for "autop")

Beau

> How can I maintain the paragraph format in the output?



More information about the thelist mailing list