[Zope] ZPT - using templates based on variables

Phil Harris phil.harris@zope.co.uk
Fri, 22 Jun 2001 15:57:30 +0100


Just a note to say this is possible and works remarkably well:

By changing this line to

       metal:use-macro="here/StandardLookAndFeel/macros/master">

 line with something like

      metal:use-macro="python:path('here/%s/macros/master' %
path('here/lookandfeel'))">

Where 'lookandfeel' is a property of the containing folder.

This means that I can use ZPT to 'skin' my site, yay, happy me!

Phil
phil.harris@zope.co.uk


----- Original Message -----
From: "Phil Harris" <phil.harris@zope.co.uk>
To: <zope@zope.org>
Sent: Friday, June 22, 2001 2:40 PM
Subject: [Zope] ZPT - using templates based on variables


> Hi all,
>
> Assume I have a ZPT documant that looks like this:
>
> <html xmlns:tal="http://xml.zope.org/namespaces/tal"
>       xmlns:metal="http://xml.zope.org/namespaces/metal"
>       metal:use-macro="here/StandardLookAndFeel/macros/master">
>   <head>
>     <title tal:content="here/title">The title</title>
>   </head>
>   <body bgcolor="#ffffff">
>     <div metal:fill-slot="main">
>       <h1>UserList</h1>
>     </div>
>   <span tal:define="def_dn string:o=cm;dn request/dn | def_dn"
> metal:fill-slot="userList_slot"
>             tal:content="structure python:here.userList(dn=dn)">
>            User List goes here
>          </span>
>     <p tal:content="structure here/ZopeAttributionButton"></p>
>   </body>
> </html>
>
> This works fine and dandy, but can anyone think of a way in which I could
> replace the
>
>       metal:use-macro="here/StandardLookAndFeel/macros/master">
>
> line with something like
>
>       metal:use-macro="here/StandardLookAndFeel/macros/$master_template">
>
> , where master_template is a variable, maybe a session variable or
similar.
>
> This would open up the possibilities no end, imagine skins using ZPT.
>
> Anyone have any ideas?
>
> Phil
>
>
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )