Re: Re: [SMARTY] php variable within include

From: Date: Sun, 08 Dec 2002 22:32:25 +0000
Subject: Re: Re: [SMARTY] php variable within include
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6702@lists.php.net to get a copy of this message
would it be complicated to add support for concatenation? I'm not too hot on all this regular expression stuff you're using in the compiler, so I won't try to hack it myself ;) note there's problems with multi-dimensional arrays too, i.e. {foo var="$bar[1][4].foobar"} doesn't seem to get parsed correctly either... --- At 2002-12-08, 16:16:00, Monte Ohrt <monte@ispi.net> wrote: >Smarty doesn't currently support contatentation. These are all valid: > >{foo var="bar"} >{foo var=$bar} >{foo var="$bar"} >{foo var="$bar/foobar"} >{foo var="$bar.foobar"} > >ie. the entire value must be either a single variable, or quoted value >which can contain embedded variables. > >Monte > >Just as you can do "$foo/bar", you can do "$foo.bar" since "." and >"/" >are not valid variable characters. > >Rasmus Schultz wrote: > >>>Weird, I can make it work like: >>> >>>{include file = "$style.css"} and {include file = $style.".css"} >>> >>> >> >>the latter didn't work for me previously, so I just >>stopped doing it - I suppose I may have been using an >>older version, that may have had a bug ... consequently >>I just don't even try to do it anymore - in fact, I've >>had to bypass this error on occassion, by passing the >>concatenated string from PHP, rather than concatenate >>it in smarty ... >> >> >> >>>but not like >>> >>>{include file=$style.css} >>> >>> >> >>that of course will not work, because there's nothing >>that tells the parser that ".css" is a string - you >>need the quotation marks for that. You wouldn't get >>away with that in PHP either :) >> >> >> >> >> >>

« previous php.smarty.general (#6702) next »