RE: Comments about Smarty's Tag
| From: | Monte Ohrt | Date: | Thu, 01 Mar 2001 15:32:29 +0000 |
| Subject: | RE: Comments about Smarty's Tag | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-249@lists.php.net to get a copy of this message | ||
It's fixed for the next release.
If you need a quick fix, here's how:
add this function to Smarty.class.php
/*======================================================================*\
Function: quote_replace
Purpose: Quote subpattern references
\*======================================================================*/
function quote_replace($string)
{
return preg_replace('![\\$]\d!', '\\\\\\0', $string);
}
in the function _compile_file, replace:
$template_contents =
preg_replace("!{$ldq}literal{$rdq}(.*?){$ldq}/literal{$rdq}!s",
'{literal}',
$template_contents);
with:
$template_contents =
preg_replace("!{$ldq}literal{$rdq}(.*?){$ldq}/literal{$rdq}!s",
$this->quote_replace($this->left_delimiter.'literal'.$this->right_delimiter),
$template_contents);
Jim Harlindong wrote:
>
> Funny
>
> <%if%> <%/endif%> works
>
> but
>
> <%literal%>
> This part will disappear in the compiled .tpl.php
> <%/literal%>
>
> the block above will be replaced into
> {literal}
>
> inside the .tpl.php
>
> Hmmmmmm
>
> > -----Original Message-----
> > From: mohrt@ispi.net [mailto:mohrt@ispi.net]On Behalf Of Monte Ohrt
> > Sent: Friday, 2 March 2001 1:02 AM
> > To: Jim Harlindong
> > Cc: smarty@lists.ispi.net
> > Subject: Re: [smarty] Comments about Smarty's Tag
> >
> >
> > We use the default tags. We have only done simple testing with <!-- -->
> > with success. I'm not sure how <% %> would work since PHP can be setup
> > to recognize those as PHP tags, and Smarty doesn't handle the escapement
> > of that syntax quite yet.
> >
> > If you're going to try <% %>, be sure asp-style tags is turned OFF in
> > php. Let us know how this goes out of curiosity.
> >
> > Monte
> >
> > Jim Harlindong wrote:
> > >
> > > Hi,
> > >
> > > I am wondering what tag do you guys use for smarty. the default {
> > > .. } is not very good for auto formatters like Dreamweaver or Tidy.
> > >
> > > Any ideas?
> > > I am thinking of using ASP's format <% .. %>
> > >
> > > the comment format <!-- .... --> will be too long to write :)
> > >
> > > Regards,
> > > Jimmy
> > >
> > > ---
> > > You are currently subscribed to smarty as: monte@ispi.net
> > > To unsubscribe send a blank email to $subst('Email.Unsub')
> > > Visit Smarty's homepage at
> > > http://www.phpinsider.com/php/code/Smarty/
> >
> > --
> > Monte Ohrt <monte@ispi.net>
> > http://www.ispi.net/
> >
> >
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/