[thelist] simple string manipulation...

Bruce Heerssen bheerssen at visualbridge.tv
Wed May 9 14:55:53 CDT 2001

> > 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?
> That's how I usually do it.  As you pointed out, this is not the only
> option.  But I agree with you that storing HTML in the database is less than
> ideal in most cases where the content is to be edited again in the future
> with a text area.

Not to be too obvious, but sometimes simply outputing the text into <pre> tags is just the ticket. Particularly if the text was
gathered from a textarea input where you can control the wrapping. This method lets you control the font styles (using css) and
colors while still retaining the original carraige returns. And no html markup in the text.

The drawback is that the lines won't wrap, so layout can get tricky sometimes. Hint, use hard wrapping when gathering the input and
set the wrap to a comfortably narrow width.

just another option...


More information about the thelist mailing list