Applying Styles

part of a tutorial on the Dynamic Publishing System by Karl Goldstein

One of the core issues addressed by this templating system is the need to apply different styles to the same underlying data. Common applications for this capability include versions with and without graphics, versions for specific browsing devices such as PDA's, and versions in multiple languages.

The basic process by which a style is applied to a page is as follows:

This lesson illustrates a simple example of how a publisher might tailor the appearance of a page to suit the whims of different clients, while maintaining control over the data presented on the page.

Create the specification file

Create a file named contacts.data in a test directory of your server and enter the following specification:

Note that we have specified a style handler as one of the general properties of this template. This particular style handler simply returns the value of a CGI query parameter. This value is transformed into the file path for a specific template to use for this page request. The algorithm for achieving this transformation will depend on your site. In this case

View the data dictionary

Create the template

Here is what the XYZ template (one of the two possible templates) looks like:

View results (Company XYZ)

View the source for the alternate template (Company ABC)

View results (Company ABC)

Tutorial Contents
karlg@arsdigita.com