引用http://plone.org/documentation/kb/customizing-main-template-viewlets/tutorial-all-pages(约占页面的1/4)
如果您只需要对Plone Default皮肤中的Viewlet进行重新排序,则只需将原始viewlets.xml从CMFPlone/profiles/default /复制到MyTheme/profiles/default /中,然后编辑复制的文件以使其反映您的需求.
当我这样做时,我没有得到任何改变,不是在重新加载之后,而是在扩建之后,无论如何.我对MyTheme/browser/templates/main_template.pt进行了一些轻微的手动更改,这些更改被拾取,所以不是这样,我的产品完全被忽略了.到目前为止,我没有触及那里的任何基本代码,所以这不是原因.
这是一个plone 3.3.5安装.谁能在这里给我一些线索?需要任何信息,我站在:)
我想要一个viewlet应用于同一个python egg中的几个内容类型的视图.我一直在做的是通过browser/configure.zcml应用标记接口
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="AnnualProgramModule.content">
<include package="plone.app.contentmenu" />
<class class="..content.programyear.ProgramYear">
<implements interface=".viewlets.IAnnualProgram" />
</class>
<class class="..content.institution.Institution">
<implements interface=".viewlets.IAnnualProgram" />
</class>
</configure>
Run Code Online (Sandbox Code Playgroud)
在我基于Grok的模板中,我有:
from zope.interface import Interface
from five import grok
from plone.app.layout.viewlets.interfaces import IAboveContentTitle
from AnnualProgramModule.content.interfaces import IInstitution
grok.templatedir('templates')
class IAnnualProgram(Interface):
"""Marker Interface for AnnualProgram content types
"""
class AnnualProgramViewlet(grok.Viewlet):
grok.require('zope2.View')
grok.viewletmanager(IAboveContentTitle)
grok.context(IAnnualProgram)
class InstitutionViewlet(grok.Viewlet):
grok.require('zope2.View')
grok.context(IInstitution)
grok.viewletmanager(IAboveContentTitle)
Run Code Online (Sandbox Code Playgroud)
这有效.但我很想知道是否有更好的方法来做到这一点.