[ZPT] question regarding scope of defines

Dieter Maurer dieter@handshake.de
Sun, 20 Jan 2002 23:32:07 +0100


Robert Rottermann writes:
 > I would like to define variables by "importing" them from a template like
 > so:
 > include.pt:
 > <div tal:define="global picture string:pic.jpg"
 > tal:replace="nothing"></div>
 > 
 > useinclude.pt:
 > <html>
 > <body>
 >   <span tal:replace="here/include.pt"></span>
 >   <img tal:attributes="src picture">
 > </body>
 > </html>
 > 
 > If I run that I get an error, that picture is not defined.
 > Error Type: Undefined
 > Error Value: "picture" not found in "picture"
 > 
 > 
 > 
 > Am I trying to do something tal is not meant for
Yes, use "metal" macros!
 > or is there some other way
 > to have the value of an variable defined outside of the actual template?
No, not with TAL (alone) -- with the exception of acquisition.


Dieter