need modifier to break up paragraphs
| From: | Jeff Dickens | Date: | Thu, 28 Nov 2002 05:59:17 +0000 |
| Subject: | need modifier to break up paragraphs | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6578@lists.php.net to get a copy of this message | ||
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.