Re: [SMARTY] Escaping the curly braces
| From: | Papp Gyozo | Date: | Sat, 10 Aug 2002 08:45:58 +0000 |
| Subject: | Re: [SMARTY] Escaping the curly braces | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5641@lists.php.net to get a copy of this message | ||
>{$some_variable|regex_replace:"/^\d{4}([a-z]|[A-Z]){2}$/":"<replaceme
>nt>"}
put your regexp into a config variable:
sample.tpl
----------
{$some_variable|regex_replace:#regexp#:#replace#}
sample.conf
-----------
regexp = "/^\d{4}([a-z]|[A-Z]){2}$/"
replace = "...what you want..."
hth,
--
Papp, Győző
- pgerzson@freestart.hu
2002. augusztus 9. 17:29 dátummal David Pavlotzky ezt írta:
> That isn't possible since it's not a literal but a variable modifier.
> Here's what I'm trying to do:
>
> {$some_variable|regex_replace:"/^\d{4}([a-z]|[A-Z]){2}$/":"<replaceme
>nt>"}
>
> I cannot use {literal} inside a smarty section. I just need to escape
> the curly braces. Maybe I want to much :-)
>
> thanx for your help anyway.
>
> On Friday 09 August 2002 16:57, Sean Chambers wrote:
> > Use the following:
> >
> > {literal}
> >
> > {/literal}
> >
> > All curly braces within those tags will be ignored
> >
> > -----Original Message-----
> > From: David Pavlotzky [mailto:david@djin.com]
> > Sent: Friday, August 09, 2002 10:33 AM
> > To: smarty-general@lists.php.net
> > Subject: [SMARTY] Escaping the curly braces
> >
> >
> > Hi,
> >
> > Is there some way to escape the curly braces
{' }' ? I'm
trying
> > to use
> >
> > regex_replace in my template but, not surprisingly, smarty barfs on
> > the curly
> > braces that I need in my regexp. It's a regexp to verify dutch
> > postal codes
> > and it looks like this:
> >
> > /^\d{4}([a-z]|[A-Z]){2}$/
> >
> > thanx for helping me out.
> >
> > David