Plone 2.1 impressionsΒΆ

Tags: plone

I've been working on Plone 2.1 products for about a month now: this is good stuff! A terrific visual goodie is livesearch (just follow the link for a quick animation of what it is). There's a lot of polish compared to previous versions. Good integration of a visual editor, better placement of copy/paste/delete functionality.

There are also improvements behind the scenes (exactly the spot where I do most of my work: programming). Example: handing stylesheets and javascript files. Plone is nicely comparimentalised, but that means you have plone itself, the main content and a couple of portlets that want to put the javascript and css they need into the header... With plone 2.1 you can register them with the javascript registry and the css registry. "Use this css all the time" (global layout); "use this css when you view a news item" (css only needed for a certain type of content) and so on. You can even easily create a different layout for logged-in and not-logged-in users this way.

I started to use this quite a lot, so I've added support for this to ArchGenXML (in the latest version), so that that generates the needed code for me. I'm lazy :-)

Just place a STYLESHEETS and/or JAVASCRIPTS property in your AppConfig.py, for example:

 # This adds two javascripts to the global registry
 JAVASCRIPTS = [{'id': 'hideShow.js'},
                {'id': 'tabsDropDown.js'}
                ]
 # This adds one global stylesheet
 STYLESHEETS = [{'id': 'internetlayout.css'}]
 # This version adds two stylesheets that are only  used when a
 # specific content type is used.
 STYLESHEETS = [{'id': 'newsitem.css',
                 'expression':  'python:object.getTypeInfo().getId() ==
"Newsitem"'},
                {'id': 'pressrelease.css',
                 'expression': 'python:object.getTypeInfo().getId() ==
"Pressrelease"'}]

ArchGenXML provides sensible defaults, only the id is needed. Just add a keyword for every item you need to overwrite. Or course, this only gets used if ArchGenXML detects that you've got plone 2.1 ;-)

A drawback that I encountered was a bit of a lack of good documentation for certain features. A quick browse through the source code helps. One really really really good piece of documentation exists, though: RichDocument: Creating content types the Plone 2.1 way by Martin Aspelli. A well-written tutorial that helped me a lot.

 
vanrees.org logo

Reinout van Rees

My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):