AW: [Zope3-Users] How can I register a simple content provider
(i.e.not viewlet)
Roger Ineichen
dev at projekt01.ch
Thu Nov 29 00:07:19 EST 2007
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20071129/715fa6a7/attachment.htm
More information about the Zope3-users
mailing list