Registering a view
First, we'll create a Product called MYPRODUCT. This is how you do it: In your Zope instance's Products folder, create a MYPRODUCT folder and therein create a file called __init__.py. Leave the __init__.py empty for now.
Then, in the same folder, create a file called configure.zcml with the following contents:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<browser:page
for="Products.ATContentTypes.interface.IATFolder"
name="my-view.html"
class=".browser.MyView"
template="my_view.pt"
permission="zope2.View"
/>
</configure>
What we did here is register a new view for the IATFolder interface with the name my-view.html. The implementation of that view goes into the class .browser.MyView, which uses the template my_view.pt. This view is guarded with the zope2.View permission.
Now we'll create that MyView class and the my_view.pt page template. Inside the MYPRODUCT folder on the filesystem, create a file called browser.py and insert the following:
from Products.Five import BrowserView
class MyView(BrowserView):
pass
This is where we will define methods later on that our template can use like view/my_method. Right now, we'll leave the view class empty.
For the template, we'll copy and modify one of the templates that comes with Plone. Let's use folder_summary_view.pt from CMFPlone/skins/plone_content and strip out everything that's in the metal:listingmacro tag so that what we have left is this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"
metal:use-macro="here/main_template/macros/master"
i18n:domain="plone">
<body>
<div metal:fill-slot="main">
<metal:main-macro define-macro="main">
<div metal:use-macro="here/document_actions/macros/document_actions">
Document actions (print, sendto etc)
</div>
<h1 tal:content="object_title" class="documentFirstHeading">
Title or id
</h1>
<a href=""
class="link-parent"
tal:define="parent_url python:here.navigationParent(here, template_id)"
tal:condition="parent_url"
tal:attributes="href parent_url"
i18n:translate="go_to_parent_url">
Up one level
</a>
<p class="documentDescription"
tal:content="here/Description"
tal:condition="here/Description">
Description
</p>
<p> Hello world! </p>
</metal:main-macro>
</div>
</body>
</html>
Save this as MYPRODUCT/my_view.pt.
Now start up your Zope, go into the Plone interface, create a folder called whatever and then visit .../portal/whatever/my-view.html.