Template Files

Overview

New pages and new sections are created from page templates and can be added to the system at any time. These at a minimum include a template control file (TCF) and a template file (TMPL), and although they can be HTML-based, rarely are anymore. HTML-based templates are considered legacy templates not generally used. More frequently, a TMPL specifies an XSL stylesheet to use, as the use of XSL stylesheets helps provide a separation of structure and content. Also included in the template file set is a custom image file used to create the thumbnail that the user sees.

Template Control File (TCF)

The TCFs generate the page creation form that accompanies the creation of a new page from a template. Users click New (from the Content > Pages screen) and are able to select a template. Templates can be designed to create a new page, a new section that creates a new directory and supporting pages, a new XSL template, other specific content pages such as those for a RSS article or archive, or a faculty profile page. Depending upon the template selected, and upon template design, the TCF provides more specifications for the page creation. For example, this can include page title, description, author, keywords, the inclusion of a navigation file, and file name, among other options.

For more information, visit the Template Control Files (TCF) page.

Templates can be created for a wide variety of purposes, such as automatically adding RSS feed capability or an RSS archive. They can also utilize the MultiEdit tag to allow for form-based editing of content such as with faculty pages. Designers can create a variety of layouts, such as a one-, two-, or three-column layouts. This can help ensure that different layouts are available for different purposes, but that they use the same style. Admins can create template groups to enable only specific templates for specific directories, thus limiting the template choice to the appropriate users and ensuring that the content is presented in the intended format.

Example of New Content Templates

Template Settings

Default Location

The template components reside in a template directory on the production server by default. This setting can be overridden on a site-by-site basis under Setup > Sites > Use Local Templates. New page templates are specific to a site. An account can include multiple sites and new page templates can be assigned and unique for each different site.

Generally, the templates directory is located in the resources folder at root directory of the production server (e.g., _resources/ou/templates). By default, templates are sorted alphanumerically as in the directory.

Directory Listing of Templates

Template Files

Changing the Template Location

The location of templates can be changed by editing the site record. Level 10 administrator privileges are required.

  1. Navigate to Setup > Sites.
  2. Select the Use Local Templates checkbox.
  3. Define the path for the templates on the staging server.

Super Admin authority level has the option of uploading the template files to the OMNI-INF/templates folder, typically found in the root directory on the staging server. Access to templates is inherited and unless otherwise restricted all templates in both directories are available.

Naming Conventions

Each template typically uses the following files:

  • TMPL: The file that contains the XML/XHTML template code and OUC (or OmniUpdate comment) style tagging.
  • TCF: The file that further expands the creation of new pages.
  • GIF: The file that represents the thumbnail.
  • XSL: The file that contains XSLT commands, XHTML, and may call other supporting files such as those for CSS or scripting.

The file format for the thumbnail image can be an extension of .gif, .png, .jpeg, or .jpg. Image file names should match the names of the templates they represent. If the prefixes of the file name (e.g., one-column.gif and one-column.tmpl.) match, then the user sees the image representing the template after clicking the New button.

If the prefixes don't match, or if a file extension other than .gif is used for the thumbnail, the complete path to the file on the production server must be defined. This is configured from Setup > Templates > Thumbnail URL field for the specific template.

Template Settings

Template (TMPL) Files

The template file must end with .tmpl. The TMPL can be coded to create text-based include files (.inc), XML files, and other files. A variety of output formats can be specified upon publish. These would most commonly include .html, .pdf, .xml, and can include a variety of other file formats. The OU Campus system by default uses XML/XSL-based templates, although for legacy purposes HTML-style templates are still supported.

For more information, visit the Template (TMPL) Files page.

Publish Control Files

The PCF (Publish Control File) is an XML data file which contains specific instructions concerning the manner in which OU Campus processes XML data upon publishing. In addition, the PCF specifies how the data is editable and displayed within OU Campus itself. The CMS users see the editable files with the .pcf extension.

For more information, visit the Publish Control File (PCF) page.

XSL

XSL (eXtensible Stylesheet Language) stylesheets are used as part of the template fileset. The XSLs are defined as separate files and contained with the _resources directory. They are frequently defined in the prolog of a TMPL as a processing instruction.

For example:

<?pcf-stylesheet path="/_resources/xsl/default.xsl" extension="html"?>

An XSL document can be defined as an XML document, which contain XSLT commands (along with HTML and CSS) and are used to transform the contents of XML documents (PCF files into more human readable forms such as HTML and XHTML.

For more information, visit the Introduction to XSLpage.