[ZPT] Some Macros Questions/Suggestions

Chris Withers chrisw@nipltd.com
Mon, 04 Mar 2002 11:55:34 +0000


Hi,

Coupla questions relating to METAL macros.

1. Can I dynamically compute which template I get my macros from?

Something like the following would be cool if it worked:

<html metal:use-macro="python path('here/somemethod')+'/macros/main'"
<body metal:fill-slot="body>
###
Some specific rendering here
###
</body>
</html>

2. In macro templates, where does here bind to?

So, the macro template to go with the above template:

<html metal:define-macro="main">
<head tal:content="here/head_method">
Dummy head
</head>
<body>
Dummy
</body>
</html>

would head_method come from the thing the tempalte in (1) was called on or somewhere else?

3. Is there any reason why define-macro and fill-slot aren't allowed on the same tag? It
would be cool for recursive definey things...

4. How hard would it be to implement a fill-attribute thing so that the following would
work:

main_template:
<html metal:define-macro="main">
<!--whatver here-->
<body metal:define-attribute="bgcolor" bgcolor="#FFFFFF">
<!--more stuff-->
</body>
</html>

another template:
<html metal:use-macro="main_template/macros/main">
<body metal:fill-attribute="bgcolor string:#FEFEFE">
</body>
</html>

thanks for all the info :-)

cheers,

Chris