Same Theme, Different Resources

by Alexander Limi — last modified Feb 20, 2010 04:16 PM
You can use the same theme.html file for more than one site, but make changes to the images, css and other static resources by using the Absolute URL Prefix Box.

Once you have your static resources set up to be delivered by a webserver like Apache, you have the power to apply variations to the same theme for different Plone sites.

Set up your Sites

To try this out, add a second Plone site to the root of your Zope Management Interface. Install the Theme Transforms Add On and, via Site Setup - Theme transform, add the same domain, theme and rules as your first Plone site.

Next, assuming that your static resources live in a folder on your hard disk called staticresources, edit the entry in the Absolute URL Prefix box in Site Setup - Theme transform to read:

http://localhost/staticresources/greensite/

Finally, go to your original Plone site and edit the Absolute URL Prefix box on that site to read:

http://localhost/staticresources/redsite/

Set  up your Theme

Now, make the links to your static resources in your theme file relative rather than absolute. 

href="test.css"

Turning to the staticresources folder on your hard disk, add a folder called greensite and drop a test.css file into it. Then add a folder called redsite and drop a slightly different version of test.css into that one.

Tweak Apache

You'll need to tweak Apache so that both sites can be seen through http://localhost. Follow the instructions in the variations section of Apache on your Mac to make a slight change to the rewrite rules in the httpd.conf file. Don't forget to restart!