[Zope] Page Template: how to reference objects in the folder
above this one?
Tino Wildenhain
tino@wildenhain.de
Tue, 05 Nov 2002 12:09:18 +0100
Hi Skip,
... snip ...
> <span tal:replace="here/standard_html_header">header</span>
>
> is sufficient (once you add "structure " to the replace expression).
>
The problem is, you should not try to 1:1 translate DTML examples
to ZPT. If you do so, you would undermine its use. Instead of
assembling a page out of small parts (like DTML does),
in ZPT you use template pages which look like the resulting page, for
example
like this:
<html metal:define-macro="master">
<head>...</head>
<body>
<div class="yourheader">Headernavigation... whatever</div>
<div class="side">Side of the page</div>
<div class="body" metal:define-slot="contents">contents of the page -
should be more structured</div>
</body>
</html>
If you view this page, you can see the HTML and design it to your needs,
even scripts can run there, for example to build navigation elements or
more.
Then you would start designing an actual content page like this:
<html metal:use-macro="here/mastertemplate/macros/master">
</html>
[x] expand macros when editing and press "Save Changes"
Then your page looks like this:
<html metal:use-macro="here/mastertemplate/macros/master">
<head>...</head>
<body>
<div class="yourheader">Headernavigation... whatever</div>
<div class="side">Side of the page</div>
<div class="body" metal:fill-slot="contents">contents of the page - should
be more structured</div>
</body>
</html>
Note that define-slot now becomes fill-slot.
This is the part you will change in your page.
There can (and probably should) be more then one
slot in the page where you can change the contents
Regards
Tino