Practical: Adding a Style Sheet to the Registry Through the Web
To use one of the registries, you have to
- Have a resource (for example a File) in your Skin with some CSS or JavaScript in it (this could, for instance, be in the custom folder of portal_skins).
- Make an entry in the corresponding registry (for example portal_css) with the id of the resource.
Make a Style Sheet
- Go to Site Setup > Zope Management Interface and navigate to portal_skins/custom
- From the add-item menu, select File
- Give your new file an id of 'css-demo.css'
- Paste the following content into the file:
body{ background-color : red } - …and save it
Add it to the CSS Registry
The registries are two tools that live only in the Zope Management Interface (ZMI); they have no interface in the Plone user-interface itself. However, you can easily find them when browsing the ZMI of your Plone site - look for portal_css and portal_javascript
- Go to Site Setup > Zope Management Interface and click portal_css. Once selected, the CSS Registry ( the one we use for this example - the JavaScript one is almost exactly the same) will present an interface displaying all the registered resources (in the case of the CSS Registry, the resources are CSS files).
- Make sure that you tick the debug mode checkbox. This will ensure that you see your changes immediately.
-
Scroll to the bottom of the form, where there is a form for adding a style sheet
- In the id field, enter 'css-demo.css' (leave the other values as they are by default for now)
- Voila! – view your Plone site and you'll easily notice its (admittedly quite horrifying) shiny red background color!
The Technical Explanation
Each
entry in the registries has an id that references a resource that can
be found in the current Plone acquisition context. Technically it could be a tool or a utility or
anything that has a name and is available, but most commonly it will
be a File object ( for static CSS and JS) or a DTML Method (for dynamic
variable replacement). The Resource Registries makes no difference as
to what the object is, as long as it can be found and called, rendered
or printed as a string.

