Re: [SMARTY] php variable within include

From: Date: Sun, 08 Dec 2002 22:16:36 +0000
Subject: Re: [SMARTY] php variable within include
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6701@lists.php.net to get a copy of this message
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 (#6701) next »