[ZPT] Passing objects
Evan Simpson
evan@4-am.com
Mon, 06 May 2002 10:27:55 -0500
Colin Fox wrote:
> I had a large, complicated ZPT that I'm trying to split up. It has
> logical sections, so I'm just taking each section out and making it a
> zpt and including it with <span tal:replace="structure
> here/subtempl"></span>
This is exactly what METAL is for. Most discussion of it centers on the
more difficult slot-oriented page macros, but breaking out bits is quite
easy. Instead of the tal:replace, you would write:
<div metal:use-macro="here/subtempl/macros/main"></div>
...and wrap the sub-template in a <div metal:define-macro="main">. Now
the subtemplate will be treated as part of the main template during
rendering, and all variables will be shared.
Cheers,
Evan @ 4-am