Here's how I do it...
Here's the first line of my index_html...
<html metal:use-macro="here/getTemplate">
'getTemplate' is a python-script, consisting of...
request = container.REQUEST
if request.has_key('pp'): return context.standard_print_template.macros['master'] else: return context.standard_template.macros['master']
It seems to be right, but, unfortunately, it does not work. What I hase: main_template - normal Page Template like this: <html metal:define-macro="page"> <body> <span metal:define-slot="body" tal:omit-tag=""> Body.... </span> </body> </html> and many other page templates that call it: <html metal:use-macro="container/templates/freehand.pt/macros/page"> <span metal:fill-slot="body"> <!-- ... --> </span> </html> You recomend me change main_template to python script: ## Script (Python) "main_template" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## request = container.REQUEST if request.has_key('print'): return context.print_template.macros['page'] else: return context.normal_template.macros['page'] ------------------------------------------------- Now, when I try to render pages I have an error: Undefined with traceback: [....skip....] File /usr/lib/python2.2/site-packages/TAL/TALInterpreter.py, line 158, in __call__ File /usr/lib/python2.2/site-packages/TAL/TALInterpreter.py, line 191, in interpret File /usr/lib/python2.2/site-packages/TAL/TALInterpreter.py, line 510, in do_useMacro File /usr/lib/zope/lib/python/Products/PageTemplates/TALES.py, line 247, in evaluate File /usr/lib/zope/lib/python/Products/PageTemplates/Expressions.py, line 198, in __call__ File /usr/lib/zope/lib/python/Products/PageTemplates/Expressions.py, line 188, in _eval Undefined: macros not found in 'container/templates/freehand.pt/macros/page', at line 1, column 1 Or in ZMI with checked "Expand macros when editing" flag: Macro expansion failed Products.PageTemplates.TALES.Undefined: macros not found in 'container/templates/main_template/macros/page', at line 1, column 1 What I do wrong and can that problem be resolved in this direction? -- Mikhail 'Xen' Kashkin