[Zope3-Users] problem trying to use layers in a custom skin

Volker Bachschneider vbachs at dzug.org
Tue Feb 20 11:34:25 EST 2007


Shaar Gabriel schrieb:
> hi. (using zope 3.3.0)
> 
> i'm trying to make my own skin, using rotterdam as a basic layer, and adding 
> my own layer.

Try something like this:


interfaces.py
-------------
""Mini-Interfaces"""

from zope.app.rotterdam import Rotterdam

class IMiniSkin(Rotterdam):
     """Mini-Skin"""


configure.zcml
--------------
   <!--Skin-->

   <interface
       interface=".interfaces.IMiniSkin"
       type="zope.publisher.interfaces.browser.IBrowserSkinType"
       />

   <utility
       component=".interfaces.IMiniSkin"
       provides="zope.publisher.interfaces.browser.IBrowserSkinType"
       name="MiniSkin"
       />

   <!--Main-Template-->

   <browser:page
       for="*"
       name="skin_macros"
       layer=".interfaces.IMiniSkin"
       template="template.pt"
       permission="zope.Public"
       />

   <!--View-Class-->

   <browser:page
       for="zope.app.folder.interfaces.IFolder"
       name="index.html"
       layer=".interfaces.IMiniSkin"
       class=".browser.ViewNotice"
       template="view.pt"
       permission="zope.View"
       />

   <!--Resources-->

   <browser:resource
     name="base.css"
     file="resources/base.css"
     layer=".interfaces.IMiniSkin"
     />


template.pt
-----------
<metal:block define-macro="page">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>

<title>
Mini
</title>

   <style type="text/css" media="all"
          tal:content="string:@import 
url(${context/++resource++base.css});">
     @import url(base.css);
   </style>

</head>
<body>

<div id="content">

   <metal:block define-slot="body">
   </metal:block>

</div>
...

view.pt
-------
<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:use-macro="context/@@standard_macros/view">
<body>
<div metal:fill-slot="body">

<p tal:replace="view/myattribute">Your Code</p>
...


Volker


More information about the Zope3-users mailing list