[Zope] How to get rid of header and footer information?
Olivier Laurent
oli@aragne.com
Mon, 3 Jun 2002 13:35:32 +0200
Here is how I'm doing it with ZPT (don't know if it's the best solution
but it works very well):
I have an 'index_html' Page Template at the top of my site. It only
contains this:
<div metal:use-macro="container/template_standard/macros/page">Ma Page</div>
I also have a 'template_standard' Page Template containing my macros:
<div metal:define-macro="page" .....>
<html>
<head>
<link .... this_is_a_link_to_a_complex_stylesheet>
</head>
<body>
<My Complex Header Here>
<div tal:replace="structure python:here.get_content(here, request)">Retrieving the page content.</div>
</body>
</html>
</div>
The 'get_content' Python Script retrieves the content. It needs 2
parameters (client, mapping)
from Products.PythonScripts.standard import structured_text
content_html = context.content_html(client, mapping)
if hasattr(context, 'stx'):
if context.stx:
content_html = structured_text(context.content_html(client, mapping))
return content_html
If I want a printable page, I add a 'print' Page template' which contains
only this:
<div tal:use-macro="container/template_print/macros/page">Printable Page</div>
And, of course, I have a 'template_print' Page Template with a more simple
header and a link to a simple stylesheet.
With that structure, if I want to add a page, I add a Folder with a
'content_html' object into it. This object could be a Page Template or a
DTML Method. And if the folder have a 'stx' properties (evaluated to true
of course), you can add your content in structured text.
So a page is just a Folder with a content_html into it.
--
Olivier Laurent.
P3B : Club Python(-Zope) Belge --------- http://www.p3b.org
OS3B : Club Open-Software(-Linux) Carolo http://www.os3b.org
Aragne : Python-Zope Solutions & Formations http://www.aragne.com