[Zope] Uses of METAL?

Alec Munro alecmunro@hfx.eastlink.ca
Mon, 04 Nov 2002 10:17:16 -0400


Felix Ulrich-Oltean wrote:

>On Mon, Nov 04, 2002 at 09:37:30AM -0400, Alec Munro wrote:
>  
>
>>How are other people using METAL in serious applications? I would
>>love to hear how it is being used by those more familiar with Zope
>>than myself.  Thanks very much,
>>    
>>
>
>The main thing we use macros for is to define an overall "master page"
>with the general layout of pages in a site, including default bits
>which are wrapped in metal:define-slot, to allow client[1] templates to
>customize those bits.  Most templates/pages in the sites are then
>something like this:
>
><html metal:use-macro="container/master_page.html/macros/page">
>
>  <metal:block metal:fill-slot="">
>
>    Some really <b>fancy</b>content.
>
>  </metal:block>
>
></html>
>
>I know you can use tal and still have components and wel--structured
>sites, but in my short experience, it seems that using METAL gives you
>more power in the actual client[1] templates, whereas with TAL alone
>I seemed to pull in a lot of things into a "main" template, taking
>power away from the specialized templates.
>
>
>1 - "client" - by client templates I mean a template that uses the
>template with macros in, i.e. the client template is either applied to
>the called object, or IS the called object.
>
>Felix.
>
>
>
>  
>
Actually, I have implemented slots in TAL, in a way (Though I do have a 
tendency to call TAL ZPT). I create a template, and I give it areas that 
it fills from session variables, and I use python scripts to manipulate 
those session variables. This gives me programmatic control over 
navigation, though I do find it gets a little complex at times.
Basically, I have templates that look like this:
<html>
 <body>
 <span tal:replace="structure 
python:container.restrictedTraverse(request.SESSION['current_page'])()"></span>
 </body>
</html>

All my anchors point to python scripts, which load the appropriate 
templates into Session variables, and then return the current default 
template.
I would love to discuss what METAL can offer me over this, because as I 
said, it does get complex.
Thanks for the response,
Alec Munro