[Zope-dev] Page Templates and nested templates
Johan Carlsson
johanc@torped.se
Mon, 2 Apr 2001 19:58:31 +0200
> There's a Tracker linked from the main ZPT Wiki page. You should be =
able to
> add it there. On the other hand, I'd like to know how exactly you've =
tried
> to nest macros, and how it failed for you.
>=20
> Cheers,
>=20
> Evan @ digicool & 4-am
>=20
Here is an examples:
ID: here/master
<html xmlns:tal=3D"http://xml.zope.org/namespaces/tal"
xmlns:metal=3D"http://xml.zope.org/namespaces/metal"
metal:define-macro=3D"master">
<head metal:define-macro=3D"head">
<title tal:content=3D"here/title">sss title</title>
<meta something=3D"">
</head>
<body bgcolor=3D"#9999ff" metal:define-macro=3D"body">
<div metal:define-macro=3D"bodymacro">
<h1>This is a macro 21</h1>
</div>
<div metal:define-slot=3D"bodySlot">
<h1>This is a H1 Header</h1>
</div>
</body>
</html>
Now notice this if I state use-macro for the METAL statement
in the HTML-tag, all subsequent metal:define-macro statements
gets replaced with the use-macro=3D"here/master/macros/master>"
ID: here/Page1 (version1)
<html xmlns:tal=3D"http://xml.zope.org/namespaces/tal" =
xmlns:metal=3D"http://xml.zope.org/namespaces/metal">
<head metal:use-macro=3D"here/master/macros/head">
<title tal:content=3D"here/title">sss title</title>
<meta something=3D"">
</head>
<body bgcolor=3D"#9999ff"
metal:use-macro=3D"here/master/macros/body">
<div metal:use-macro=3D"here/master/macros/body">
<h1>This is a macro 21</h1>
</div>
<div metal:define-slot=3D"bodySlot">
<h1>This is a H1 Header</h1>
</div>
</body>
</html>
But if I instead apply the use-macro on the body and the head
this are working perfectly, subsequent define-macros in the inner
div gets turned in to use-macro=3D"here/master/macros/body" though.
ID: here/Page1 (version2)
<html xmlns:tal=3D"http://xml.zope.org/namespaces/tal" =
xmlns:metal=3D"http://xml.zope.org/namespaces/metal">
<head metal:use-macro=3D"here/master/macros/head">
<title tal:content=3D"here/title">sss title</title>
<meta something=3D"">
</head>
<body bgcolor=3D"#9999ff"
metal:use-macro=3D"here/master/macros/body">
<div metal:use-macro=3D"here/master/macros/body">
<h1>This is a macro 21</h1>
</div>
<div metal:define-slot=3D"bodySlot">
<h1>This is a H1 Header</h1>
</div>
</body>
</html>
=20
How I would want it to work is that if a higher level
of macro is set to use-macro the subsequent level=20
would remain unchanged (e.g. as define-macro) until
I explicitly change it in to use-macro.=20
I would then be able to set it to any macro definition,
e.g. use-macro=3D"here/master/macros/bodymacro" or
use-macro=3D"<some other path>/macros/<some other macro>" etc.
I think what would make allot of sense and that's probably how it=20
supposed to work, right?
Best regards,
Johan Carlsson