Overview

of the Dynamic Publishing System by Karl Goldstein
Next | Top

The Problem

The traditional way to create dynamic pages for AOLserver was to write "pages that are really programs," mixing Tcl code, database queries and HTML in a single file. This approach was convenient under the following conditions:

Alas, the world of web publishing is not so monotonic these days. Most web publishing teams are faced with the following dilemma(s):

The complexities of contemporary web publishing demand more attention to improving productivity and collaboration among all members of the team. Programmers need better ways to reuse code and avoid the need for constant changes with every change to the formatting of a page. On the other side of the fence, designers need the freedom to change the look and feel of a page without having to consult with the programmer.

The Goals of this System

Within the context of the ACS, a good solution to this problem should possess the following characteristics:

Data Organization

Considering the goals stated above, the core data components of the system include the following:

Page Processing

The templating system works by defining a filter on all URLs that end with the adp extension. When a user requests an adppage from the server, the filter procedure intercepts the request and performs the following steps:

  1. The procedure substitutes the data extension for adp in the URL and looks for a template specification file at that location. If no specification file is found at that location, than the filter terminates and processing of the adp page is handed back to the web server.

  2. If the procedure finds a specification file, it parses the specification into a special data structure for processing. This data structure is cached, so parsing only occurs the first time the file is requested or when the file changes. The latter behavior may be disabled for better performance when a site is not under active development.

  3. A list of data sources is obtained from the template specification. The content from each of these data sources is obtained, either by performing a database query or by evaluating a Tcl expression. Each content value is stored in a special variable that the template can then reference to insert dynamic content into a page.

  4. Once the content is defined, the procedure checks the template specification for directions on template selection. The first step in this process is to determine the master template for a page. Typically the master template specifies a skeletal layout and include page components found on all pages of a site, such as a standard header, navigation bar, footer, and a content area. The specification can indicate a non-default master template to use, or that no master template should be used at all.

    The master template may need to be chosen dynamically depending on a user's preferences and browser configuration. A default master template is specified as a configuration parameter.

  5. The second step in template selection is to determine the proper content template to use. The content template usually specifies the layout only of the content area of a page. The rest of the page is specified by a master template as described in the previous step.

    The default behavior is to look for a content template at the requested URL. Alternatively, the developer may specify a procedure to dynamically choose from one of several templates written to present the same or similar content. There is no absolute convention for how alternate templates may be named, but there are at least two possibilities:

  6. Once the dynamic content has been prepared and the templates have been selected, the final HTML for the page can be generated and returned to the client.

Next | Top

karlg@arsdigita.com