In template I can access first level variables directly (<span tal:content="title" />). Is it possible to "switch context" to "parent" object by some redefining so I could access second level variables not by "parent/title" but also direct "title"? My current (ugly) workaround is $data => Object ("self" => Object(...), "parent" => Object(...)) so I could redefine "self" with "parent" when needed..

I'm not sure what you're trying to do. If macro refers to "title" rather than "parent/title", you can call macro like this:

<tal:block tal:define="title parent/title" metal:use-macro="..."/>

You can use tal:define like that elsewhere. It supports multiple variables:

tal:define="var1 obj/var1; var2 obj/var2"

There's no mass-define for all object's properties. You could save some typing with:

tal:define="p parent"

--
regards, Kornel




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

Reply via email to