[thelist] php speicial character conversion and carriage returns
Michele Wandrei
michele at inthree.com
Tue May 7 14:10:18 CDT 2002
Hi Kristina,
> $description = nl2br("$description");
>
> What can I do so that it doesn't repeat the carriage returns
on a
> re-edit, bearing in mind that if new carriage returns are
added they
> will need to upload as such.
Here's what works for me with those multiplying <br> tags. When
I call the text to be displayed from the database, I stick this
line in before the text is displayed for editing:
/* strip all standard and XHTML-compliant <br> tags */
$description =
eregi_replace('<br[[:space:]]*/?[[:space:]]*>', "",
$description);
That strips all the <br> tags from the text. Then I use nl2br()
again before inserting the edited text back into the database.
I wish I could give credit where credit is due! I don't remember
where I stumbled on this little bit of code, but it has served me
very well.
Hope this helps!
Michele
___________________________________________________
Michele Wandrei
inThree Design
www.inthree.com
More information about the thelist
mailing list