<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>AW: [Zope3-Users] How can I register a simple content provider (i.e.not viewlet)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">HI</FONT></SPAN>
</P>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> Betreff: [Zope3-Users] How can I register a simple content </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> provider (i.e.not viewlet)</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> With which ZCML directive can I register a simple content </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> provider, say for the main menu. The browser namespaces only </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> has viewlet and viewletManager directives, which must be used </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> together to provide the ability to include multiple viewlets </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> in an area represented by viewlet manager.</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> In some simple cases, we just know there can not be multiple </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> elements to be included in the area, and want to simply </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> register a content provider. How to do this in ZCML?</FONT></SPAN>
</P>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">You can use the adapter directive for this.</FONT></SPAN>
</P>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">class IHeaderProvider(zope.contentprovider.interfaces.IContentProvider):</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> """Header provider."""</FONT></SPAN>
</P>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">class HeaderProvider(object):</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> """Header content provider."""</FONT></SPAN>
</P>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> zope.interface.implements(IHeaderProvider)</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> zope.component.adapts(zope.interface.Interface, IMySkinBrowserLayer, zope.interface.Interface)</FONT></SPAN>
</P>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"><zope:adapter</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> name="IHeaderProvider"</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> factory=".header.HeaderProvider"</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial"> /></FONT></SPAN>
</P>
<BR>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">Regards</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">Roger Ineichen</FONT></SPAN>
</P>
<BR>
<P><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> --</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> Hong Yuan</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> </FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="MS PGothic">> 大管家网上建材超市</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Simsun">> 装修装潢建材一站式购物</FONT></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> </FONT></SPAN><A HREF="http://www.homemaster.cn"><SPAN LANG="de-ch"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://www.homemaster.cn</FONT></U></SPAN></A><SPAN LANG="de-ch"></SPAN>
<BR><SPAN LANG="de-ch"><FONT SIZE=2 FACE="Arial">> </FONT></SPAN>
</P>
</BODY>
</HTML>