RE: [Zope] Can one nest macros with slots?

2006-01-26 Thread Doyon, Jean-Francois
The situation:

I have a main_template that does the looks of the site, with a main slot
where the content goes, much like the standard templates give you.

Now I have objects that behave similarly and share some interface
components, so I figured I could try to create another macro, with another
slot to fit inside that main slot, that all of the objects/content types
could re-use.

So I end up doing what I said below ... But that doesn't work :(

I've come up with an alternative for now, though it's not as elegant as this
I think ... But it'll have to do.

If you care to keep reading, the details:

main_template:

define-macro=master
  ... some html ...
  define-slot=main /
  ... some html ...
/define-macro

shared template:

use-macro=main_template/master
  fill-slot=main
define-macro=shared
  ... some html ...
  define-slot=sharedslot /
  ... some html ...
/define-macro
  /fill-slot
/use-macro

Object specific template:

use-macro=shared
  fill-slot=sharedslot
  ... some html ...
  /fill-slot
/use-macro

This works without errors, except that only the first macro shared comes
out, the master one never gets processed :( I would've expected this to be
recursive ... Ah well :(

Thanks!
J.F.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J
Cameron Cooper
Sent: January 26, 2006 12:52 AM
To: Doyon, Jean-Francois
Cc: zope@zope.org
Subject: Re: [Zope] Can one nest macros with slots?

Doyon, Jean-Francois wrote:
 I can't seem to do this:
 
 use-macro
   fill-slot
 define-macro
   ... Some html ...
   define-slot/define-slot
   ... Some html ...
 /define-macro
   /fill-slot
 /use-macro
 
 Allowing me to nest multiple reusable templates?
 
 I have objects with common interfaces which could easily share templates
...
 If I could do this! (The shared template still needs to endup in the 
 master template).
 
 Or are there other techniques to achieve this?

Macros are decided at compile time so that you can ask a template (which is
not called) for its macros::

   here/main_template/macros/master

The code above would have macros being created in some other template at the
time this macros is used, and I cannot imagine how they would be available.

Why is a macro with whatever uses your common interfaces not suitable? 
You scenario is too vague for any other advice.

--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Can one nest macros with slots?

2006-01-25 Thread Doyon, Jean-Francois
I can't seem to do this:

use-macro
  fill-slot
define-macro
  ... Some html ...
  define-slot/define-slot
  ... Some html ...
/define-macro
  /fill-slot
/use-macro

Allowing me to nest multiple reusable templates?

I have objects with common interfaces which could easily share templates ...
If I could do this! (The shared template still needs to endup in the
master template).

Or are there other techniques to achieve this?

Thanks!

Jean-François Doyon
Internet Service Development and Systems Support / Spécialiste de
dèveloppements internet et soutien technique
Canada Centre for Remote Sensing/Centre Canadien de télédétection
Natural Resources Canada/Ressources Naturelles Canada
http://atlas.gc.ca
Tel./Tél.: (613) 992-4902
Fax: (613) 947-2410
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Can one nest macros with slots?

2006-01-25 Thread J Cameron Cooper

Doyon, Jean-Francois wrote:

I can't seem to do this:

use-macro
  fill-slot
define-macro
  ... Some html ...
  define-slot/define-slot
  ... Some html ...
/define-macro
  /fill-slot
/use-macro

Allowing me to nest multiple reusable templates?

I have objects with common interfaces which could easily share templates ...
If I could do this! (The shared template still needs to endup in the
master template).

Or are there other techniques to achieve this?


Macros are decided at compile time so that you can ask a template (which 
is not called) for its macros::


  here/main_template/macros/master

The code above would have macros being created in some other template at 
the time this macros is used, and I cannot imagine how they would be 
available.


Why is a macro with whatever uses your common interfaces not suitable? 
You scenario is too vague for any other advice.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )