How to define default views in Plone

天大地大妈咪最大 提交于 2019-12-12 11:51:27

问题


I have already a page template for the default view of a Plone site (main page). How to define the default view of a folder? This default view should use a page template.


回答1:


Try this:

  • navigate to the desired folder
  • add "/manage_propertiesForm" at the end of the url
  • in the resulting form add this property:
    • name: "layout"
    • type: "string"
    • value: the page template name without extension



回答2:


Use the answers above if you want to set one of the default views (tabular, thumbnail, etc), but if you want to choose a particular content item for the default view of the folder, you can do it in the ZMI as suggested:

  • navigate to the desired folder
  • add "/manage_propertiesForm" at the end of the url
  • in the resulting form add this property:
    • name: "default_page"
    • type: "string"
    • value: the id of the content item

or do it programmatically in Python:

content_id = "Name of the Content Item"
folder.manage_addProperty('default_page', content_id, 'string')

Hope this helps!




回答3:


Using the information and links send both by Giacomo Spettoli and by Mikko Ohtamaa, another guy from my work team was able to find a solution for our case:

  • do as indicated by Giacomo (navigate to desired folder, etc.)
  • include a new directive in the configure.zcml file (this was found by on of my team mate Mr. Mariano):

    <browser:page for="OFS.interfaces.IFolder" name=<name of the page template file> class=<name of the class used by the above template file> permission="zope2.View" />
    

Thanks to Giacomo and to Mikko; their answers helped us solve this issue.



来源:https://stackoverflow.com/questions/8914479/how-to-define-default-views-in-plone

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!