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'] Hope this helps! P -----Original Message----- From: xen_ua@mail.ru [mailto:xen_ua@mail.ru] Sent: Tuesday, 24 December 2002 2:38 AM To: zope@zope.org Subject: [Zope] ZPT Print Theme Zope.org site have a print version with light design. How I can make "print version" like on Zope.org for my site on ZPT if all my Page Tamplates use macros from 'main_template' Page Template. "Print" attribute will be getted from GET part of REQUEST: request.print == 'on'. -- Mikhail 'Xen' Kashkin _______________________________________________ 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 )
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
participants (2)
-
Mikhail -
pskipworthï¼ touchcorp.com