RE: [SMARTY] Stripping slashes
| From: | John W. Holmes | Date: | Tue, 04 Mar 2003 06:13:52 +0000 |
| Subject: | RE: [SMARTY] Stripping slashes | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8369@lists.php.net to get a copy of this message | ||
> I'm pulling textual data from a MySQL db and, of course, the
single
> quotes are escaped with a slash. Is there any way to perform a
> strip_slashes() in a template? The people who will be editing the
> templates
> will not have access to any other files.
Unless you have magic_quotes_runtime set to ON, you shouldn't see any
quotes within your data when you pull it from the database. If the
setting is OFF,and you're still seeing quotes, then you are somehow
calling addslashes() twice before inserting the data.
For your question, use:
$smarty->register('stripslashes','stripslashes');
then in your template:
{$foo|stripslashes}
If your smarty version supports this...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/