Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 7. Layout Customization - Pg. 120

120 Chapter 7. Layout Customization Plone uses a skinning mechanism to define its user interface. This allows easy and non-destructive customization of the look of a Plone site, as well as separation of the display code from the content the system is managing. The skins mechanism and allied services like the form controller and ac- tions define the Plone web UI. Most of the concepts in this chapter are CMF- or Plone-specific. The two template languages DTML and ZPT, however, come solely from Zope. We will not attempt a full explanation of either--there are many Zope-specific places that do that--but we will provide a good grounding. Most of the work in this chapter can be done either in the ZMI or on the file system. This will be the usual circumstance from now on, as we are getting more into customization than configuration. Remember: the ZMI and Python code are your friends. The code of Wonderland in this chapter is provided as version 1.0 in the code download from http:// www.packtpub.com/. Skins Web page rendering in Zope systems is performed, as usual, with live objects. In a generic Zope web application, these objects--templates, scripts, static files, images, and the like--are stored in the same space as the content, if any, and are usually defined only in the ZODB. For Plone, however, it is desirable to define these objects on the file system as well as in the ZODB, to separate the content and to make customization easy. The skins tool provides all these capabilities. Layers The basic component of the skins system is the layer. Layers are folderish objects contained in the portal_skins tool, under the Contents tab. Some layers, like the default custom layer, are regular in-ZODB folders. These (and their contents) can be edited like any other folder. More com- monly, layers get their content from Products on the file system. This is done with the Filesys- tem Directory View type of object, which is a folderish object that creates its contents based on the contents of a directory on the file system. FSDVs cannot write to the file system, and so from the web side are read-only, which is why content objects contained in such an object have a 'lock' icon and otherwise look different from a regular editable object of that type. The Customize button provides a handy way to make an in-ZODB editable copy of that object in a regular folder in the skins tool. See Chapter 5 for a walk-through of this procedure. Filesystem Directory View A Filesystem Directory View (FSDV) is associated with a specific directory registered with the skins tool. From the contents of that directory it creates read-only versions of common types of Zope objects. Registration with the skins tool can be done only by code that resides on the file system as a security measure, and is almost always done in the initialize method of a Product. Most of