Hi all: I'm trying to nest several macros but only the last is showed. I define for example macroA with a slot named slotA for example. macroB uses macroA and fills slotA, but also defines a slot.. something like this: ----------------- MacroA <html xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal" metal:define-macro="macroA"> <head> <span metal:define-slot="slotA"> </span> ----------------- MacroB <div xmlns:metal="http://xml.zope.org/namespaces/metal" metal:use-macro="container/macroA/macros/macroA"> <span metal:fill-slot="slotA"> <div align="center" metal:define-macro="macroB"> <span metal:define-slot="slotB"></span> </div> </span> </div> -----------------Page And last I use the macroB with: <div xmlns:metal="http://xml.zope.org/namespaces/metal" metal:use-macro="container/macroB/macros/macroB"> <span metal:fill-slot="slotB"> <br>Hello! </span> </div> I think all the process is as follows: Page calls macroB, macroB calls macroA, and all the code is rendered, the problem is only the code inside macroB is rendered... It's posible to nest macros this way? Greetings.
Antonio Beamud Montero wrote at 2006-8-22 08:46 +0200:
... ----------------- MacroB <div xmlns:metal="http://xml.zope.org/namespaces/metal" metal:use-macro="container/macroA/macros/macroA"> <span metal:fill-slot="slotA"> <div align="center" metal:define-macro="macroB"> <span metal:define-slot="slotB"></span> </div> </span> </div>
"macroB" is only the inner "div" not the complete content of your page template.
... I think all the process is as follows: Page calls macroB, macroB calls macroA, and all the code is rendered, the problem is only the code inside macroB is rendered...
"macroB" does not call "macroA" because "macroB" does not contain a "use-macro" for "macroA".
It's posible to nest macros this way?
Not the way you try it... -- Dieter
El mar, 22-08-2006 a las 19:13 +0200, Dieter Maurer escribió:
Antonio Beamud Montero wrote at 2006-8-22 08:46 +0200:
... ----------------- MacroB <div xmlns:metal="http://xml.zope.org/namespaces/metal" metal:use-macro="container/macroA/macros/macroA"> <span metal:fill-slot="slotA"> <div align="center" metal:define-macro="macroB"> <span metal:define-slot="slotB"></span> </div> </span> </div>
"macroB" is only the inner "div" not the complete content of your page template.
... I think all the process is as follows: Page calls macroB, macroB calls macroA, and all the code is rendered, the problem is only the code inside macroB is rendered...
"macroB" does not call "macroA" because "macroB" does not contain a "use-macro" for "macroA".
It's posible to nest macros this way?
Not the way you try it...
Ok... I want to define a template (like a skeleton), other template (like the body of the skeleton) and lot of templates in sections of the body of the skeleton and reuse the skeleton and the body across all my web... How I can do that? It's posible or only one level of macro definitions is posible? Where I can find examples or resources about that...? A lot of thanks.
Antonio Beamud Montero schrieb:
Ok... I want to define a template (like a skeleton), other template (like the body of the skeleton) and lot of templates in sections of the body of the skeleton and reuse the skeleton and the body across all my web... How I can do that? It's posible or only one level of macro definitions is posible? Where I can find examples or resources about that...?
Maybe the new MacroExtension feature is what you need: http://www.zope.org/Wikis/DevSite/Projects/ZPT/MacroExtension I'm not sure if it's possible with Zope 2.x Page Templates though. HTH, Tonico
--On 22. August 2006 19:31:44 +0200 Tonico Strasser <contact_tonico@yahoo.de> wrote:
Antonio Beamud Montero schrieb:
Ok... I want to define a template (like a skeleton), other template (like the body of the skeleton) and lot of templates in sections of the body of the skeleton and reuse the skeleton and the body across all my web... How I can do that? It's posible or only one level of macro definitions is posible? Where I can find examples or resources about that...?
Maybe the new MacroExtension feature is what you need: http://www.zope.org/Wikis/DevSite/Projects/ZPT/MacroExtension
I'm not sure if it's possible with Zope 2.x Page Templates though.
Likely with the Zope 3 ZPT implementation within Zope 2.10. -aj
Antonio Beamud Montero wrote at 2006-8-22 19:21 +0200:
... Ok... I want to define a template (like a skeleton), other template (like the body of the skeleton) and lot of templates in sections of the body of the skeleton and reuse the skeleton and the body across all my web... How I can do that?
I do not understand what you precisely want to achieve. However, you could get something like the example in your original post by: * define "macroB" at the page level (it uses "macroA") * make your former "macroB" a "macroC" and define it inside a slot. * then you can use "macroB" (which will use "macroA" in turn) and fill the slot with a use of "macroC" (or something else). -- Dieter
El mar, 22-08-2006 a las 19:34 +0200, Dieter Maurer escribió:
Antonio Beamud Montero wrote at 2006-8-22 19:21 +0200:
... Ok... I want to define a template (like a skeleton), other template (like the body of the skeleton) and lot of templates in sections of the body of the skeleton and reuse the skeleton and the body across all my web... How I can do that?
I do not understand what you precisely want to achieve.
However, you could get something like the example in your original post by:
* define "macroB" at the page level (it uses "macroA")
* make your former "macroB" a "macroC" and define it inside a slot.
Sorry, but I don't understand this... can you give me a simple example (I think is the same I have tried before..) A lot of thanks
* then you can use "macroB" (which will use "macroA" in turn) and fill the slot with a use of "macroC" (or something else).
Antonio Beamud Montero wrote at 2006-8-22 19:45 +0200:
...
I do not understand what you precisely want to achieve.
However, you could get something like the example in your original post by:
* define "macroB" at the page level (it uses "macroA")
* make your former "macroB" a "macroC" and define it inside a slot.
Sorry, but I don't understand this... can you give me a simple example (I think is the same I have tried before..)
The only thing you may not understand is 'define "macroB" at the page level' (because everything else is from your example). A macro defined at the page level looks like this macroB (PageTemplate) <metal:page define-macro="macroB"> .... </metal:page> -- Dieter
participants (5)
-
Andreas Jung -
Antonio Beamud Montero -
Antonio Beamud Montero -
Dieter Maurer -
Tonico Strasser