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.
Asked
Active
Viewed 2,163 times
3 Answers
7
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

Giacomo Spettoli
- 4,476
- 1
- 16
- 24
-
Ciao Giacomo! Grazie mille pela tua riposta. Is it possible to make this modification via Python? – HelioAraujo Jan 18 '12 at 18:04
-
2Yes it is: `folder.manage_addProperty('layout','*templatename*','string')` – Giacomo Spettoli Jan 18 '12 at 18:46
-
Grazie! Another question: is is possible to do this in a configuration file/folder? Like, for example, the structure folder with the .properties file? – HelioAraujo Jan 19 '12 at 13:01
-
1No there isn't that feature out-of-the-box but it won't be too difficult to implement. – Giacomo Spettoli Jan 19 '12 at 13:13
-
Could you please, point me to some resource where this implementation would be explained? Thanks in advance. – HelioAraujo Jan 19 '12 at 13:16
-
Terve Mikko! Kiitos for the answer. I'll check it and see if I can make it work. – HelioAraujo Jan 20 '12 at 12:29
-
1@MikkoOhtamaa's link updated: http://docs.plone.org/develop/plone/content/dynamic_views.html – silviot Sep 23 '14 at 12:48
6
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!

Spanky
- 5,608
- 10
- 39
- 45
2
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.

NullUserException
- 83,810
- 28
- 209
- 234

HelioAraujo
- 227
- 1
- 10