[ZPT] Re: macros and contexts

Seb Bacon seb at jamkit.com
Fri Sep 12 11:24:21 EDT 2003


Seb Bacon wrote:
> This is kind of difficult to explain, partly because I suspect I am 
> trying to abuse macros.  I want to use macros to display objects other 
> than the current context.  So, say I have a macro in a ZPT called 
> widgetlib:
> 
>  <div metal:define-macro="widget_1_view">
>    I am the widget 1 view on <span tal:replace="here/getId">some
>    id or other</span>
>  </div>
> 
> And I use it like this:
> 
>  <div metal:use-macro="here/widgetlib/macros/widget_1_view">
>    Widget 1 view goes here
>  </div>
> 
> How can I cause the above macro invocation to use a different value for 
> 'here'?

Just to follow up, the solution I have thought of so far is to redefine 
the value of  'here':

  <div tal:define="here nocall:here/foo">
   <div metal:use-macro="here/widgetlib/macros/widget_1_view">
     Widget 1 view goes here
   </div>
  </div>

Which is pretty nasty, but really seems to be the only solution...?

seb





More information about the ZPT mailing list