[Zope] ZPT - using templates based on variables

Phil Harris phil.harris@zope.co.uk
Fri, 22 Jun 2001 14:40:33 +0100


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