[Zope3-Users] Still a skinning problem

Florian Lindner mailinglists at xgm.de
Sat Feb 3 07:36:06 EST 2007


Hello,
I am doing a repost here, since the problem really bugs me and I have gotten 
no replys anymore...

I have a template template.pt which should be applied to all site visited 
within the skin xgm.

    <page
        for="*"
        name="standard_macros"
        permission="zope.Public"
        class=".views.StandardMacros"
        layer="xgm.interfaces.IXGMSkin"
        allowed_interface="zope.interface.common.mapping.IItemMapping"
    />

    <page
        for="*"
        name="skin_macros"
        permission="zope.Public"
        layer="xgm.interfaces.IXGMSkin"
        template="template.pt"
    />

and

class StandardMacros(BaseMacros):
    macro_pages = ('skin_macros', )


the template.pt is the one also used on xgm.de:

<metal:block define-macro="page">
<metal:block define-macro="view">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
  
    <head>
        <title metal:define-slot="title">Testtitle</title>
        <link rel="stylesheet" type="text/css" tal:attributes="href 
context/++resource++files/styles.css" />
    </head>
  
    <body>

        <ul id="navigation">
            <li>[ <a tal:attributes="href 
context/@@index.html/@@absolute_url">home</a> ]</li>
    
        </ul>
    
        <div id="content">
            <metal:block define-slot="body">
                This is the content.
            </metal:block>
        </div>

    </body>
</html>

</metal:block>
</metal:block>

(shortened a bit)


index.html is registered like that:

    <pages
        for="xgm.interfaces.IXGM"
        layer="xgm.interfaces.IXGMSkin"
        permission="zope.Public"
        class=".views.ViewClass" >

        <page
            name="index.html"
            template="index.pt" />

     </pages>

This works perfect as far as only pages use this template who are registered 
on the same interface like the other ines (IXGM).

Now I have a third party package (Blog) which should generally be independent 
to all that but should use the template.pt which called with ++skin++xgm.

<html metal:use-macro="views/standard_macros/view">
  <body>
    <div metal:fill-slot="body">
      <h1 tal:content="context/title"></h1>
      <div tal:content="context/description" />

      <div class="row" tal:repeat="item view/getSortedBlogEntries"
           tal:content="structure item/@@details.html" />
    </div>
  </body>
</html>

is registered on the default layer. Since the xgm layer derives from the 
default layer it correctly uses my template.pt.
But the problem is now when a view from the Blog object are called links in 
the template like

<a tal:attributes="href context/@@index.html/@@absolute_url">home</a>

do not work anymore, since context is the Blog and not a IXGM object anymore. 
Therefore the lookup fails.

Sorry for the long mail, I hope I was able to explain what my problem is.

Thanks,

Florian


More information about the Zope3-users mailing list