Sunday, January 10, 2010

AntHill Skinner, yet another theming approach for Plone

Anthill Skinner is another approach to theming Plone, developed by Simon Pamies of banality.de. It is inspired by collective.skinny and collective.editskinswitcher It claims to be easy..."er".

It provides utilities to create a nice public facing theme while relying on the default Plone theme as the administrative "backend" interface. This approach allows a developer to quickly create a front end, without being contrained by some of the considerations associated with being compatible with the plone publishing tools. Instead the publishing tools exist in a familiar, consistent and well thought out, default Plone UI.

For scenarios where there are a few contributors and the site is largely aimed at anonymous visitors, anthill.skinner is good enough (tm). The traditional Plone approach is important for membership sites where users are expected to log in and see the same look and feel as when they are logged out and anthill.skinner won't replace that use case.


AntHill Skinner Tools

Tools that will help to simplify your anthill.skinner theming experience:

  • anthill ZopeSkel template – I created a custom ZopeSkel branch which includes a plone3_anthill_theme template to help you get started quickly (still very alpha).
  • GloWorm – quickly identify the full path to a viewlet, useful when customizing and you need to reuse an existing viewlet.
  • Buildout – This will simplify the setup, the instructions below assume familiarity with buildout.

The fastest way to get started is to use my customized branch of ZopeSkel which makes it possible to generate an anthill theme.

Checkout the anthill ZopeSkel branch:

cd $YOURBUILDOUT
svn export http://svn.plone.org/svn/collective/ZopeSkel/branches/anthill_skinner/ src/ZopeSkel

Add ZopeSkel to your buildout.cfg

(It is important to add the src/ZopeSkel line.)
develop =
src/ZopeSkel
eggs =
...
ZopeSkel

Then re-run buildout

bin/buildout

Now you can create your theme. Remember to locate it in the 'src' directory of your buildout. Leave out the --svn-repository command if you don't want to have the project managed by subversion.

bin/paster create -t plone3_anthill_theme \
mytheme.example --svn-repository=http://myrepo.mycompany.com/svn/{projectname}

Answer all the questions and you'll have an anthill ready theme.

Remember to move the resulting theme to the 'src' directory of your buildout.

Now edit your buildout.cfg to resemble what you see below, note the use of 'z3c.autoinclude' as a part of the eggs section:

develop =
...
src/mytheme.example

eggs =
...
mytheme.example
anthill.skinner
z3c.autoinclude
anthill.tal.macrorenderer

zcml =
...
mytheme.example
anthill.skinner

Then run

bin/buildout

Installing the theme

Go to the ZMI of your plone instance > portal_quickinstaller.

  1. Install anthill.skinner first
  2. Install your new theme
update: one "gotcha", before the public view of my newly installed theme would work as advertised, I found that I needed to restarted zope/plone.

Customizing the theme

When you first generate and install your theme, the public view (what an visitor sees) will look like this.
20100110-qq6m2w9ct74j9b26ek8a8nukyr.jpg (540×425)

The administrator will standard plone (note the ability to "Show preview", which allows an admin to see the public view:

20100110-nmtidexx99metdbtn27g8dpphh.jpg (788×472)

When registering your skin via profiles/default/skins.xml, note that 'portal_skins' default_skin will be "Plone Default" NOT the name of your theme (this is the default behaviour of the anthill paster template).


Most of the rest of your work will be focused on customizing the 'skins/...custom_templates/main_template.pt' and stylesheets, this is discussed on the anthill.skinner page.

No comments:

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos