Plone Templating
07/12/2005 11:50 PM · plone, python, cms
I’ve worked with a variety of CMS. At the enterprise end it’s been Vignette and at the lightweight end it’s been Movable Type or WordPress. I’ve played with Bricolage and Typo3 and what differentiates each, regardless of size, is their workflow and templating. With that in mind as my criteria I have been mightily impressed by Plone.
The templating system isn’t a full blown template system as much as it is some extra attributes that you add to your XHTML. You don’t learn any new syntax, just some attributes that contain Plone or Zope expressions. The HTML coder can create the code right there, and then the Plone developer just tweaks it with extra attributes to fill in the content.
Here is some sample code that grabs a list of links from the content manager, and then displays them in a table. The tal stuff is mixed in as attributes and xml elements in this particular case.
<table
tal:define="results python:here.portal_catalog(portal_type='Link',
sort_on='id',
review_state='published')"
tal:condition="results">
<tal:block tal:repeat="obj python:[r for r in results if r.getObject()]">
<tr
tal:define="link obj/getObject">
<td>
<img src="" alt="" tal:replace="structure here/icon_bullet.gif" />
<a href="#" tal:attributes="href link/remote_url"
target="_blank"
tal:content="link/title_or_id">Link Title</a>
</td>
</tr>
</tal:block>
</table>
It’s simple and you can use all the same XML tools you already use to work with it.
Another powerful concept that comes to Plone through Zope is Acquisition and this solves another problem of many CMS systems, building dynamic URLs.