On Thu, 18 Jun 2009, cimodev wrote:

> i have the following problem:
> 
> There is an text-area, where user can edit some text containing line breaks.
> After submit, i will show this text in an paragraph, but all linebreaks
> should be converted to "<br>"-Tags.
> 
> How can i do this?
> 
> In Documentation i found the str_find_replace-Function. But i want to
> ask you, if there would be another solution, because i think, this is a
> common task.

The best way would to do this by styling the output with CSS. Instead of 
replacing the text, you can do this:

<p style="white-space: pre-wrap">
{$variable}
</p>

See also: http://www.w3.org/TR/CSS21/text.html#white-space-prop

regards,
-- 
Derick Rethans
eZ components Product Manager
eZ systems | http://ez.no
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to