Ok, they aren’t evil :) but let me explain what I think the future of Plone is and why I think Templates should have less a role than they do now. To do this, I’m going to introduce three new technologies that work together to provide a better experience. In order, they are Diazo, Deco and Dexterity.
A CMS's job is really one of separation of concerns. It allows you to separate content from HTML. You don't need to know HTML to add web pages and you don't need to know what the content is to improve the HTML, CSS or other aspects of the theme. Of course this is a simplification. But consider that a CMS is a tool which is serving two different kind of users. The process the content editor goes through, using a visual editor etc., is the UX to create and manage content. The themer uses tools such as page templates and a text editor, git, etc. to rearrange the content and other parts of the HTML to achieve the right "theme". So Page Templates, or the process of adding/customising them, can be viewed as the UX for a themer.
A good UX is one that requires minimal learning and provides powerful tools to let someone do just what they want with minimal effort. If a themer has to understand too much about content or the content editor has to understand too many details of how a theme gets put together then the UX is bad.So a good CMS is really a tool that allows separation of concerns providing just the right level of UX to these very different user roles. Of course this is a simplification. We can identify these different user roles a really good CMS should be servicing1. Content Editor2. Administrator
3. Themer
4. Backend Developer (plugin developer)
5. IntegratorYou can even count the anonymous viewer (end user) or the Reviewer (when you need workflows).That's seven different UX's a CMS has to get right. This is why, even though building a CMS seems simple, it is in fact very difficult.
Use cases for Customising Templates
So why are Template customisations evil?
Because consider who wants those customisations and what they want them for. Most of these customisations fall into the following categories1. Rearrange or alter the HTML, or2. hide parts of the HTML
3. Change the wording
4. Expose additional information from the databaseThe people who want these are the Content Editors and the Themer, and these tasks have typically been done by the Integrator using Template/BrowserView overrides. Templates require learning a new language, TAL and potentially python, and the concepts of programming and what comes with it: breaking things. Templates and BrowserViews are awesome tools for programmers, i.e. integrators and plugin developers.
Templates: wrong tool in certain hands
So you can see the problem: one set of users (themer and content editor) desire some change, but the UX for doing so is really designed for someone with a lot more technical knowledge (Integrator or backend developer). The UX for the themer and content editor therefore involves change requests, requests for quotes, etc. etc. to get some basic things done. It makes Plone expensive and slow to change from their perspective. Or it requires themers and content editors to also be integrators thus reducing the total pool of possible themers and content editors dramatically and thus limiting the spread of an otherwise awesome CMS. So it's not that template customisations are evil, but rather they are a poor UX for those that need them.
Template customisations have some other problems too. Generally they are too low level. If you want to make some of the above changes what you would do is take a copy the whole template and make a couple of changes and then the store the template in a way that overrides the original. What happens if Plone upgrade changes the underlying template? You'll first have review all your customisations to see if any are built on changed templates, reverse engineer the intent of your customisations and re-apply it to the new base template. Complicated and error prone.
Why Diazo
Luckily the smart people behind Plone have already identified some of these problems. Plone 4.2 ships with Diazo. Diazo is a fantastic tool in that it caters for tasks 1 & 2 while requiring only a very minimal set of simple rules to be learnt. The tools involve working with an API which is the raw HTML of a CMS and CSS selectors... languages they already understand. Easy!. To be honest, you can actually use Diazo to change the wording in templates. I've done this. It's not a great idea but it simple to understand how to do. Diazo is also great in that Plone now has the ability for change its innards more easily, and as long as the same HTML is produced, Diazo themes won't break.
Why Deco
So what about task “Expose additional information from the database” (#4)? For example, let’s say an Administrator wanted each of their news items to include a video in the top right hand corner of the page? This is where Deco comes in. Deco allows an Administrator to drag and drop a video to the top right of a news item and then save this layout so editors can use it when creating new content. No knowledge of any template language required. No upgrade hell since, as long as Deco is supported in the core of Plone, the same layouts will work.
Why Dexterity
Now let’s say the Administrator wanted this video to have some additional metadata displayed, such as a title and copyright. This is where Dexterity comes in. The administrator can create a new content type via the dexterity schema editor with video title, video copyright, and then drag these fields onto the deco layout. Again no code needed[1].
Why we need even more
Now let’s say the Administrator wanted the video to appear in a popup once clicked. This is something a themer using diazo can take care of. Again, no templates changed. As long as there are consistent CSS selectors produced by Deco to identify the video and its associated information, anyone with some JQuery knowledge can do this for the Administrator.
Let’s say they now wanted a listing all the top 5 video news items on the from page including an image that lets you play the video in a popup. Actually this is something outside of the scope of the current Deco proposal. Deco would let you create a content listing tile similar to a collection portlet now, but currently the format of the listings are “baked in” and would need to be overridden with templates to customize. Crap, we’re back to finding an integrator again :( But it’s easy to see how with an enhanced contentlisting tile plugin there could be a UI to select and arrange fields visually from content items to define a “popup video row”. No Templates required.
Going beyond Templates: no more expensive Integrators
Hopefully you can see that this no templates thing is a big benefit. Here is where I see Plone can go. We eliminate the integrator role all together. We have a bunch of powerful plugins that allow an Administrator, Editor and Themer to do everything they need to make a modern content site by themselves, and this can be done entirely through a web interface. This means someone can install Plone, and create a very customised site with very little learning at all. It puts Plone squarely ahead of WordPress, Drupal, Joomla, etc. which still rely heavily on PHP template customisations. It opens up Plone to the hobbyist market, the key which has made WordPress the most popular CMS in the world. Unlike its competition, Plone is the “elevator that goes all the way up”. Its enterprise features such as distributed authoring, flexible workflow engine and excellent security record allow it to be used for complex intranets, large content sites and complex extranet/member sites.
By the way, I think another excellent addition to Plone would be TTW localization such that if any templates contained words they wanted to change, they don’t have to resort to template customisation, diazo or custom filesystem locales to make such a simple fix.[1] Actually I’d argue that making an Administrator have to create a whole new Type just to add extra video metadata is still too hard. Instead a better UX might be to let the Administrator create a new Tile Type through the web via some kind of Tile editor and drag that on to the content object. However that’s a whole separate blog post).