[for the history] Re: [Product-Developers] Re: Howto create a page template for a folderish archetype content type?
Mirto Silvio Busico
mirtosilvio.busico at fastwebnet.it
Wed Mar 24 10:25:34 UTC 2010
Raphael Ritz ha scritto:
> Mirto Silvio Busico wrote:
>> Hi all,
> Hi Mirto,
>> I'm trying to create a custom view for a content type derived from
> Hope you solved this in the meantime
> but if not and for the archive ...
Thanks a lot for your reply,
Yes, in the meantime I solved this; but, for the history I'll write
below how I have done it.
>> How can I put in the .pt file the data relative to the items
>> contained in the folder?
>> I looked at http://plone.org/documentation/manual/developer-manual
>> but I was not able to find what I need.
>> I tried to find the base_view.pt (well this was the name in plone 2.5
>> days) for atfolder between the plone eggs; but I found nothing.
>> Probably it changed name and egg.
> 'base_view' should still be around in the
> 'archetypes' skin layer (code base:
> the Product.Archetypes egg, portal_skins
> in ZMI) and it should be the default view
> for all AT-based content types (though I have
> to admit that I have no idea whether AGX messes
> with that).
> base_view in turn pulls in a bunch of macros:
> header, body, folderlisting, footer (or so) which
> can selectively be overridden on type basis (the
> <portaltype>_view.pt way as pointed out).
> If you do not see a folderlisting part for your type
> I would start by checking the conditions used by the
> folderlisting macro in your context.
> BTW: what do you get when you just append '/base_view'
> to the URL of an instance of your custom type?
> See http://www.zopyx.de/downloads/documentation/mysite.pdf/view
> and there in particular the 'Views' subsection in
> 'Basic customization' section of the 'Customizing
> Archetypes' chapter.
Thanks. I'll look at this asap.
[... how I solved ....]
To be clear, I'll use the real paths I have on my machine; but these
paths can be different on other installations.
I installed PLone 3.3.4 in /usr/local/plone334 with unified installer
The in the src directory I created a product named Products.gas3
(Products is needed for archgenxml)
create with ../bin/paster create -t archetype giving namespace
"Products" and package "gas3"
In the dir /usr/local/plone334/zeocluster/src/Products.gas3/Products
create an UML file gas3.zargo (I used argouml)
In the UML
* create a class gas3collection (stereotype <<atfolder>>) [well, my
diagram is more complex but for solving the problem this suffice]
* in this class set the tagged values for "base_view" and
"immediate_view" to "g3_coll_view"
* create a package named "browser"
* in this package create a class "g3_coll_view" with stereotype
* link this class with the class "gas3collection" with a
"dependence" arrow (dotted line arrow and the arrow pointing to
Now generate the the code with archgenxml
in the dir
edit the file g3_coll_view.py
Add the lines
##code-section module-header #fill in your manual code here
from plone.app.layout.globals.interfaces import IViewView
from zope.interface import implements, Interface
g3_coll_view view interface
""" test method"""
and in the class definition add the "implements" line
##code-section class-header_g3_coll_view #fill in your manual code here
At this point edit the g3_coll_view.pt file in
adding the content to the div:
I took the code from
ATTENTION: drop any reference to the "python:test" instruction: this
causes a runtime error in this framework but still works in Plone framework.
Drop lines 40-42
tal:attributes="class python:test(here.Format() in ('text/structured',
'text/x-rst', ), 'stx' + kss_class, 'plain' + kss_class)">
Drop line 82
tal:attributes="class python:test(oddrow, 'even', 'odd')">
After this the custom view shows correctly.
launchpad bug about python:test
Getting the Add… Menu in your custom browser views (content actions):
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 284 bytes
Desc: not available
More information about the Product-Developers