Through the Web Theming using Python

Exclusive offer: get 50% off this eBook here
Plone 3.3 Site Administration

Plone 3.3 Site Administration — Save 50%

Alex Clark's book will get you managing and enhancing your Plone website like a seasoned expert

$23.99    $12.00
by John Ward | July 2010 | Open Source

Plone is a powerful web application used mainly for website content management and comprised of many different, but related Python packages

In the previous article we have learned How to Examine themes with Omelette and Python and How to create a theme package using Zopeskel

In this third article of the article series by John Ward, Author of Plone 3.3 Site Administration we will learn :

  • Examining themes in the ZMI
  • Making changes through the Web

Download code from here

(Read more interesting articles on Plone here.)

Examining themes in the Zope Management Interface

Now that we have seen in part how themes work, let us take a closer look at their representation in Zope Object Database (ZODB).

Browse to http://localhost:8080/Plone. Click on Site Setup Zope Management Interface| and you should see:

Through the Web Theming using Python

This is a Through the Web (TTW) representation of all the objects in the database at the Plone site level (the application root is one level above).

The most frequently used theme-related objects here are:

  • portal_css
  • portal_javascripts
  • portal_skins
  • portal_view_customizations

Of these, portal_css and portal_javascripts are most often used to enable their respective debug modes, wherein the CSS and JavaScript files are not compiled into a single file (not to be confused with Zope 2's debug mode which detects filesystem changes in real time when enabled).

Take a look at your site with Firebug, in particular the style tab.

You should see:

Through the Web Theming using Python

Now enable debug mode in portal_javascripts and look again. You should see:

Through the Web Theming using Python

When portal_css debug mode is enabled, we can see (or by viewing the HTML source) that the CSS files are loaded individually in Firebug.

The same applies to portal_javascripts debug mode.

This can be absolutely invaluable when trying to correlate various visual elements with their respective sources.

In addition to debug mode, you can also add CSS/JavaScript files to their respective registries through the Web, which brings us to the next topic.

Plone 3.3 Site Administration Alex Clark's book will get you managing and enhancing your Plone website like a seasoned expert
Published: July 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

(Read more interesting articles on Plone here.)

Making changes through the Web

Let us continue our ZMI walkthrough by examining both portal_skins and portal_view_customizations.

portal_skins

Browse to http://localhost:8080/Plone. Click on Site Setup Zope Management Interface | portal_skins|.

You should see:

Through the Web Theming using Python

If you scroll down and click on my_theme_custom_images you will find the image you added earlier:

Through the Web Theming using Python

If you wanted to upload a new image, you could click the Customize button and upload it, but keep in mind that change will only exist in the database.

Assuming you want to keep the my.theme package up-to-date (in a software repository for example), you may prefer to customize the image on the filesystem (and resist the temptation to customize it through the Web).

If you do customize through the Web, consider the changes only temporary or volatile.

portal_view_customizations

Next up is portal_view_customizations where we will explore yet another way to customize the logo.

Browse to http://localhost:8080/Plone. Click on Site Setup Zope Management Interface | portal_view_customizations | zope.interface.interface | plone.logo.

You should see:

Through the Web Theming using Python

If you wanted to, you could click the Customize button and change the image tag code:

Through the Web Theming using Python

Since we used the same file (logo.jpg), the site will look exactly the same.

But now you can upload a new image and change the code as you see fit. To demonstrate this, let us now browse to http://localhost:8080/Plone and click on Site Setup Zope Management Interface | portal_skins | custom and add an image|:

Through the Web Theming using Python

You can use any image you like, but we will use Vlogo250.gif from the Zope logo pack: http://www.zope.com/about_us/legal/low_res.zip.

Now return to http://localhost:8080/Plone and click on Site Setup Zope Management Interface | portal_view_customizations | zope.interface.interface | plone.logo| and change the filename to Vlogo250.gif:

<a metal:define-macro="portal_logo"
id="portal-logo"
accesskey="1"
tal:attributes="href view/navigation_root_url"
i18n:domain="plone">

<tal:comment replace="nothing">
<img src='//dgdsbygo8mp3h.cloudfront.net/sites/default/files/blank.gif' data-original="logo.jpg" alt=""
tal:replace="structure view/logo_tag" />
</tal:comment>

<img src='//dgdsbygo8mp3h.cloudfront.net/sites/default/files/blank.gif' data-original="Vlogo250.gif" />

</a>

You should see:

Through the Web Theming using Python

Summary

That's it for this article series. We have just demonstrated several ways to customize Plone's appearance with (hopefully) simple examples to convey the pros and cons of each method.

You have learned:

  • How to browse for themes on plone.org and install them with Buildout
  • How to use Omelette and Python to examine theme package contents
  • About theme package contents
  • How to create a theme package, and perform a simple customization
  • How to find your way around the ZMI
  • How to customize themes through the Web

If you have read this article you may be interested to view:


Plone 3.3 Site Administration Alex Clark's book will get you managing and enhancing your Plone website like a seasoned expert
Published: July 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

About the Author :


John Ward

John Ward is a consultant for Innovent Solutions, specializing in BIRT and e-commerce search and navigation solutions. Prior to that, John was an Assistant Vice President for Citibank, North America, managing the training MIS group and overseeing development of new technology-based training initiatives. John actively works with and tests BIRT—an open-source reporting platform built on Eclipse—including development work based on BIRT reports and the BIRT APIs.

John also maintains The Digital Voice blog at http://digiassn.blogspot.com

Books From Packt


Plone 3 Multimedia
Plone 3 Multimedia

Plone 3 Intranets
Plone 3 Intranets

Plone 3 Products Development Cookbook
Plone 3 Products Development Cookbook

Microsoft Dynamics GP 2010 Cookbook
Microsoft Dynamics GP 2010 Cookbook

Mastering Joomla! 1.5 Extension and Framework Development Second Edition
Mastering Joomla! 1.5 Extension and Framework Development Second Edition

WordPress 2.8 Themes Cookbook
WordPress 2.8 Themes Cookbook

CMS Made Simple 1.6: Beginner's Guide
CMS Made Simple 1.6: Beginner's Guide

The Oracle Universal Content Management Handbook
The Oracle Universal Content Management Handbook


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
u
m
j
z
s
H
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software