Re: AW: [SMARTY] smarty variables used in {include...}
| From: | Andr� Rabold | Date: | Thu, 20 Feb 2003 15:34:45 +0000 |
| Subject: | Re: AW: [SMARTY] smarty variables used in {include...} | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8006@lists.php.net to get a copy of this message | ||
How about updating the manual (if it isn't already done) to explain that
users should
use strcat / concat modifier plugin (which should be included in distrib).
Something like this:
Smarty support imbedding variables within strings:
{foo bar="blah $blah"}
For more complex string concatination use the concat modifier
{foo bar="blah "|concat:$blah|concat:"xyz"}
Then new users should know from the beginning what Smarty can do and what
not.
I started using Smarty with version 2.1 I think. Imbedding wasn't supported
so I never
used it. And now I have no problems with constructs like
"$smarty.section.foo.tpl" ;-)
André
"Monte Ohrt" <monte@ispi.net> schrieb im Newsbeitrag
news:1045752727.711.35.camel@lena.ispi.prv...
> curly brace syntax won't work. escaping won't work because some
> environments use "\" as a directory delimiter.
>
> Monte
>
> On Thu, 2003-02-20 at 03:01, Matthias Mohr wrote:
> > > Hmm, this would cause a problem:
> > >
> > > {foobar foo="$smarty.section.foo.tpl"}
> > >
> > > That won't work, the .tpl will get caught as part of the smarty var. I
> > > suppose this is acceptible though, that situation shouldn't happen.
> > >
> > > I can limit the number of segments to 3, but that leaves a hole for
> > > something like
> > > "$smarty.now.tpl"
> > >
> > > Who knows, we may have more than 3 segments to a Smarty var some day.
> > > We'll leave it as is for now.
> > Hmm, maybe it would be best to add a "escape-character", which tells the
parser
> > that the next character does not have it's usual meaning and instead it
should use it
> > as is?
> > Then you would have to write the above line as follows:
> > "$smarty.now\.tpl"
> >
> > I think this would solve the problems with detecting the variables-part
and the text-part
> >
> > Another possibility would be the way Unix shell languages do; there you
can surround any
> > variable with a "{" "}" -pair.
> > Then the above would be this:
> > "${smarty.now}.tpl"
> > But I think this would be confusing here, because the normal
smarty-delimiters are also paranthesis
> > and the following would look terrible in my oppinion:
> > {foobar foo="${smarty.section.foo}.tpl"}
> >
> > What do you think?
> >
> > with regards,
> > Matthias
> --
> Monte Ohrt <monte@ispi.net>
>