[ZPT] Simple Variable Call

Dieter Maurer dieter@handshake.de
Sun, 1 Dec 2002 23:39:37 +0100


beno writes:
 > Here's two lines of code from a Page Template:
 > 
 > This is Page Template <em tal:content="template/id">template id</em>.<br><br>
 > <p tal:replace="structure 
 > python:here.theFrame(here.size(),`here.template.id`)" />
 > 
 > In the latter line I want to call the same_variable referenced in the 
 > former line (template/id or template.id). How do I do it?
I usually use:

  <...
    tal:define="templateId	template/id;"
    tal:replace="... templateId ..."
  >

i.e. introduce an auxiliary variable definition.

But the "path" function will do the same effect "path('template/id')".

When you resolve "template/id" (or other path expressions) yourself,
you need to know lots of things. Usually, I try to avoid this road.


Dieter