2011-09-20 59 views
2

getMainTemplate覆盖在我们从Plone的2迁移到Plone 4中一个较旧的现场,我们已经重写用于使用所述内容类型中定义的方法getMainTemplate特定的基于拱形物-内容类型的主模板:置换在Plone 4+

def getMainTemplate(self): 
    """ this defines the main template to use in base_edit/view/etc for this 
    item of content """ 
    return 'a_different_main_template' 

在Plone 4中,这不再起作用。该方法中的pdb没有命中,所以大概这已被删除。可能有充分的理由,因为这种模型/视图混合看起来很混乱。

我试图从下面的http://plone.org/documentation/manual/theme-reference/buildingblocks/skin/templates/how-to-customise-view-or-edit-on-archetypes-content-items指令覆盖编辑表格,但不能了解一个大概去改变用于编辑表单主模板。我只能通过填充插槽将内容添加到页面。我试图改变打开HTML标签没有成功:

<html xmlns="http://www.w3.org/1999/xhtml" 

    xml:lang="en" 

    lang="en" 

    xmlns:tal="http://xml.zope.org/namespaces/tal" 

    xmlns:metal="http://xml.zope.org/namespaces/metal" 

    xmlns:i18n="http://xml.zope.org/namespaces/i18n" 

    metal:use-macro="here/a_different_main_template/macros/master" 

    i18n:domain="plone"> 

(其中a_different_main_template在我的皮肤层定义旁边我定制的编辑模板)

是否有替换用于特定的主模板的新途径键入使得在特定的默认编辑视图将使用它(我很好重写“视图”的观点,但不希望重新编辑/添加的形式,只是一个新的模板中使用它们)?

回答

2

通常的做法是为您的类型注册一个@@编辑视图,在您的页面模板中使用您的宏,并确保它被设置为FTI(portal_types)中的'编辑'方法别名的目标。您可以将标准base_edit.pt文件复制显然为起点,为您的新观点。