logo       

Re: [SMARTY] Accessing Assigned Variables: msg#00467

php.smarty.general

Subject: Re: [SMARTY] Accessing Assigned Variables


I think you misunderstand what I want to do.

there is no '$var1' in my PHP. If you read closely, I assigned like this:

$smarty->assign("var1","data");

Just to make sure I wasn't on drugs, I tried what you said and of course, got back:

Notice: Undefined variable: var1 in xxx.php on line xxx

As I mentioned, I can do this by accessing $smarty->_tpl_vars['var1'] but I thought there was a cleaner way.


Ferdinand Beyer wrote:

On 31 Jan 2003 at 12:43, Darryl Bleau wrote:


I know I saw this in the mailing list someplace, but I can't find it. (It would be nice if the mailing list archive were searchable! :) ).


Sometimes a quick look into the manual does the trick :-)


in my php:

$smarty->assign("var1","data");

then later, I want to do something like this:

if ($smarty.variables.var1 == "data")
...

possible?


Of course. But why do you want to use $smarty.variables.var1 if you could simply use $var1?

if ($var1 == "data")

or

if ($var1 eq "data")

I don't want to be rude but why don't you guys read the quick start guide and the manual before posting questions to the mailing list?


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise