[Zope] How to get rid of header and footer information?
John Schinnerer
johnschinnerer@yahoo.com
Fri, 31 May 2002 22:03:56 -0700 (PDT)
Bonjour,
--- Lorenz Lorenz-Meyer <lorenz@clubvolt.de> wrote:
> But it is in my opinion no good solution for the more
> general problem of a clear-cut separation of structured
> content on the one hand and layout information on the
> other.
> I would still very much like to learn a way to
> have the main text area treated like a normal field -
> with associated dtml-methods providing for the looks of
> the content on different page-types.
I suspect that you can do what you are asking using ZPT - as I
understand it ZPT is (are?) explicitly designed to support the
separation you are asking for (if I understand what you're asking
for...).
> Take, for example, a situation where you want the
> complete content of a document included in some kind
> of list. How would you do that? Probably by handing
> over some parameter like "noheader" that is tested by
> the header method (<dtml-unless noheader>....). I
> think this is illogical. It should be the other way
> round somehow.
For this case, I think you can make a ZPT 'shell' that iterates (with
tal:repeat) through whatever page body ZPTs you want in the list and
inserts each one into the rendered page via macro.
With ZPT macro stuff (METAL), your page layout 'shell' template,
header, footer, and body/content (and whatever other parts you want)
are separated. You can render a page body without header/footer simply
by calling a different 'shell' template that doesn't include header and
footer macros. Or you can do it with a TAL condition statement that
includes (or not) header/footer macros (or whatever) depending on
context.
For my printable pages I simply have a 'printerpages' folder with an
alternate style sheet (same name, different styles) in it. To render
somefolder/somewhere/coolpage with printer page style, I call
somefolder/somewhere/printerpages/coolpage, so that the printable page
style sheet is found first. In some instances I combine this with
conditions based on context, for example to use a grayscale logo
instead of color on printable pages, like this:
<!-- use color logo if not in printerpages -->
<span tal:condition="python:request.PARENTS[0].id!='printerpages'">
<img src="graphics/pageshelllogo.gif" alt="Home" width="95" height="56"
border="0">
</span>
<!-- use grayscale logo if in printerpages -->
<span tal:condition="python:request.PARENTS[0].id=='printerpages'">
<img src="graphics/pageshelllogogray.gif" alt="Home" width="95"
height="56" border="0">
</span>
cheers,
John S.
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com