Page Templates

Page Templates

A page template renders a page with a fixed number of columns, optionally declaring custom CSS to do so. The standard templates included with the Layout Manager package are designed to work with the standard OpenACS css classes which were implemented in the core release 5.3, and derived from the earlier Theme Zen package released with .LRN.

Declarating a Page Template

layout::page_template::new \
    -name 1_column \
    -description "#layout-manager.simple_1column_layout_description#" \
    -columns 1 \
    -template /packages/layout-manager/lib/page-templates/simple
The "name" parameter must be unique across the system and is used internally as the page template's primary key.

The "description" parameter, preferably localized, is the text displayed to the user when they choose a format for a page.

The "columns" parameter declares the number of columns this template expects. The layout manager ensures that the number of columns built for a page is less than or equal to this parameter (it will be less if there are fewer elements than columns placed on a page).

The "template" parameter is the full path to the template which will build the page. It is possible to write a single script to handle a family of page template declarations, indeed the provided "simple" template script does just that. It dynamically assigns a CSS file associated with the declared page template's name, and dynamically chooses an ADP file to render the page.