In CMF the folders called skins are folders that have python scripts and Zope's page templates that can be called from whichever URL of the server.
To add the skins tool feature to the product CPSMessages the process is this:
- Add a file called skins.xml to the folder CPSMessages/profiles/default. The text of the file should look like this:
<?xml version="1.0"?>
<object name="portal_skins" meta_type="CMF Skins Tool">
<object name="messages_default" meta_type="Filesystem Directory View"
directory="CPSMessages/skins/messages_default"/>
<skin-path name="CPSSkins">
<layer name="messages_default" insert-after="custom"/>
</skin-path>
<skin-path name="CPSSkins-macroless">
<layer name="messages_default" insert-after="custom"/>
</skin-path>
</object> - Add a new step to the file CPSMessages/profiles/default/import_steps.xml with this content:
<import-step id="skins" version="20040630-01"
handler="Products.CMFCore.exportimport.skins.importSkinsTool"
title="Skins Tool">
<dependency step="toolset"/>
Import skins tool's filesystem directory views and skin path definitions.
</import-step> - Create a folder in the path CPSMessages/skins/messages_default.
- In the folder created in step 3, add a file called hello_skins.zpt with these words in it:
<p i18n:translate="hello_skins_imported">
Hello, skins were imported sucessfully!
</p> - Register the skins directory so that Zope can access to its content. The way to do it is to add these two lines to the file CPSMessages/__init__.py.
from Products.CMFCore.DirectoryView import registerDirectory
registerDirectory('skins', globals()) - Restart Zope. The restart is needed because __init__.py file changed.
- Go to the tab Import of the tool portal_setup and check the step called Skins tool. Make sure that CPSMessages is the chosen profile in the combo box titled Profile and click the button “Import selected steps”.
- In the tool portal_skins you should see a folder called messages_default and after clicking on it, an object called hello_skins should be in there (notice that the extension is ommited). Click on the object hello_skins and use the tab “Test” to see it in action.
Questions? Please, leave a comment ;-)
No comments:
Post a Comment