Re: need modifier to break up paragraphs
| From: | Andr� Rabold | Date: | Thu, 28 Nov 2002 08:31:49 +0000 |
| Subject: | Re: need modifier to break up paragraphs | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6580@lists.php.net to get a copy of this message | ||
{$text|@nl2br}
should work if you don't use Smarty's Save-Mode.
Have fun,
André
"Jeff Dickens" <dickens@dreamgear.com> schrieb im Newsbeitrag
news:CCELIEJMKMNBHIPNDJPNMEJNCEAA.dickens@dreamgear.com...
> Greetings.. I've been reading this list for a few days and have been
working
> with Smarty for a week or so. And now I have a question.
>
> I find myself doing this in php:
>
> $search = "\n";
> $replace = "<br />";
> $smarty->assign("text",str_replace($search, $replace, $text));
>
> It seems to me this might be better done by a modifier in Smarty.
>
> In my application (a single-purpose CMS) text is entered in a form and
> stored in a database. When the text is retrieved for display, I want it
to
> be displayed with the original line breaks, so I replace all the newlines
> with "<br />".
>
> Anyone have a plugin to do this ? If not I'm going to try my hand at
> writing one.
>
> The usefulness of the new textformat function escapes me, unless you're
> going to put it inside of a <pre>. What I need is something like
textformat
> that outputs html.
>