HI

> Betreff: [Zope3-Users] How can I register a simple content 
> provider (i.e.not viewlet)
> 
> With which ZCML directive can I register a simple content 
> provider, say for the main menu. The browser namespaces only 
> has viewlet and viewletManager directives, which must be used 
> together to provide the ability to include multiple viewlets 
> in an area represented by viewlet manager.
> 
> In some simple cases, we just know there can not be multiple 
> elements to be included in the area, and want to simply 
> register a content provider. How to do this in ZCML?

You can use the adapter directive for this.

class IHeaderProvider(zope.contentprovider.interfaces.IContentProvider):
    """Header provider."""

class HeaderProvider(object):
    """Header content provider."""

    zope.interface.implements(IHeaderProvider)
    zope.component.adapts(zope.interface.Interface, IMySkinBrowserLayer,
zope.interface.Interface)

<zope:adapter
    name="IHeaderProvider"
    factory=".header.HeaderProvider"
    />


Regards
Roger Ineichen


> --
> Hong Yuan
> 
> 大管家网上建材超市
> 装修装潢建材一站式购物
> http://www.homemaster.cn
> 
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to