> <div tal:condition="php: person['first_name'] eq 'John'"> blah blah</div>

Do you need the single quotes perhaps?

On 19 May 2011, at 14:02, GRolf wrote:

> 
> 
> I have set an array to my PHPTal:
> 
> $phptal->person = array('first_name'=>'John', 'last_name'=>'Doe');
> 
> 
> Works fine to retrieve those values in my template
> 
> <div>${person/first_name}</div>
> 
> 
> However, how can I use that in tal:condition?
> 
> <div tal:condition="php: person[first_name] eq 'John'"> blah blah</div>
> throws an error.
> 
> I know that for objects I need to use person.first_name, but what about 
> arrays?
> 
> <div tal:condition="php: person/first_name eq 'John'"> blah blah</div>
> does not work either...
> 
> 
> 
> (how come this kind of basic information is not in the manual? Even the fact 
> that a variable is just ${varname} is not in the basic example...)
> 
> 
> 
> 
> 
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to