[Zope3-Users] Problem with macro

Marius Gedminas mgedmin at b4net.lt
Sun Feb 25 09:03:04 EST 2007


On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote:
> I have a simple problem. A template:
> 
> <html metal:use-macro="views/standard_macros/view" i18n:domain="xgm.de/Blog">
>   <body>
>     <metal:block metal:define-macro="Blog">
>     <metal:block metal:fill-slot="body">
>       <h1 tal:content="context/title" />
>       <div tal:replace="context/description" />
>          [...]
>       </div>
> 
>     </metal:block>
>     </metal:block>
>   </body>
> </html>
> 
> That is registered as view.html.

How?  <browser:page name="view.html" template="foo.pt" /> ?

> Now I want to use the macro in another page:
> 
> div metal:use-macro="context/Blog/@@view.html/Blog" />
> 
> (tried different variations)

Ah, but did you try

      metal:use-macro="context/Blog/@@view.html/index/macros/Blog" />

?

When you attach a page template to a view with ZCML, it defines a view
attribute 'index' behind the scenes.  So, @@view.html refers to the
view, @@view.html/index revers to the template, and
@@view.html/index/macros refers to the macros defined in that template.

Marius Gedminas
-- 
For every complex problem, there is a solution that is simple, neat, and wrong
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20070225/5e7a2177/attachment.bin


More information about the Zope3-users mailing list