[ZPT] Picking a macro on the fly

Wolfgang Klinger hermann.klinger@chello.at
Tue, 19 Feb 2002 10:03:48 +0100


hiya!

from the zope book:
(http://www.zope.org/Members/michel/ZB/)

----
Zope handles macros first when rendering your templates. Then Zope evaluates TAL expressions. For example, consider this macro:

        <p metal:define-macro="title"
           tal:content="template/title">
          template's title
        </p>

----

but you can try to create the page template dynamically with
python and insert the appropriate code at runtime ...
(?)

Wolfgang

> 
> Von: Chris Meyers <chris@hddesign.com>
> Datum: 2002/02/18 Mo PM 10:46:30 GMT+01:00
> An: zpt@zope.org
> Betreff: [ZPT] Picking a macro on the fly
> 
> Hey all,
> Is there a way to mix tal and metal in the same tag so that you can pick a macro on the fly? What I would like to do is something like this:
> 
> <html metal:use-macro="python:here.pickSomeMacroHere()">
> ...
> </html>
> 
> where pickSomeMacroHere() is a python script which selects a macro based on the user. If you can't mix tal and metal, is there any other way to do this. I've looked through the ZPT tutorials and the mailing list, but I haven't found any info regarding this.
> 
> Any suggestions appreciated,
> Chris
> 
> -- 
> Chris Meyers
> 7941 Tree Lane Suite 200
> Madison WI 53717
> 
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
>

---------------------------
wazum-mail ;-)
e-mail: wolfgang@wazum.com
web: http://www.wazum.com