Use the ArrayAccess interface and implement your own iterator in your Person object, no?
http://php.net/manual/en/class.arrayaccess.php Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 29 August 2012 15:39, GRolf <[email protected]> wrote: > > > > Is it possible to use variable variables in PHPTal ? > > eg I have a PHP array > $phptal->fieldnames = array(array('key'=>'first_**name', > 'description'=>'First Name'), array('key'=>'address', > 'description=>'Address'); > > and an object > $person= new stdClass(); > $person->first_name = 'Joe'; > $person->address='His_street 1'; > $phptal->person = $person; > > and in my template I'd like to use the "key" of "fieldnames" in a repeat > ... > > > <div tal:repeat="field fieldnames"> > ${field/description}: ${person/${field/key}} > </div> > > > This doesn't work - but is there an other way to achieve it ? > > ______________________________**_________________ > PHPTAL mailing list > [email protected] > http://lists.motion-twin.com/**mailman/listinfo/phptal<http://lists.motion-twin.com/mailman/listinfo/phptal> >
_______________________________________________ PHPTAL mailing list [email protected] http://lists.motion-twin.com/mailman/listinfo/phptal
