BASICS

ADMINISTRATION

DEVELOPMENT

SUPER ADMIN

  LAST UPDATED
11/13/2012

Template (TMPL) Files

The TMPL file is one of the core files used in templating. When a user fills out the New Page Wizard, the TCF and TMPL work together to create a PCF file on the staging server. By default, XML/XSL templates are used; although, legacy HTML-based templates are also supported. The template must be saved with the extension .tmpl. The prefix to the extension should follow the file naming convention for the site.

TMPL Overview

The TMPL also contains the code that tells the template control file (.tcf) what and where to insert the text the user defines. This echo var coding uses predefined system variables to pass the user’s text and other values to the TCF. For example, a user might want to create a new page. They click the New button, and choose the One Column Template. They are presented with the New Page Wizard form that includes a field with the prompt "Enter Page Title." The value entered here is passed by the {title} variable in the TCF to the echo var declaration that includes the title variable for the value. The resulting PCF includes both the value of the variable, the actual page title, the appropriate page protocol tagging (e.g., XHTML) such as a <title></title> element, and any necessary OU Campus tagging.

More than one TMPL file can be used with a TCF. In advanced templates, the process of creating a new page can actually create many pages, files, and folders all at once. A template file might also call more than one XSL file. One example is the use of different XSL stylesheets to create different output files such as both an HTML formatted page and a PDF.

Typically, although can easily vary from site to site, or account to account, templates are placed in the following directory:

_resources/ou/templates

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

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

SuperAdmin 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.

File Naming Convention

Usually, the TMPL and the TCF prefixes in a file name should match. For example, if the TCF is named onecolumn.tcf, the TMPL should take the name of onecolumn.tmpl. The name of the TMPL will be used in the TCF <template /> tag.

By default, file naming convention in the OU Campus system restricts the available character set that may be used when creating and naming a new page file or uploading a file. This file naming conventions includes lowercase letters, numeric values, hyphen, underscore, and period only. The regex for this naming convention would be:

[a-z0-9\-_.]*

File naming convention can be configured for a site from Setup > Sites > File Naming.

Creating Logical Paths

During new page creation, the page may be stored in many possible directories at different levels of the server. For that reason the image and link paths should be absolute. For instance, if the image has a src="/ox/z-includes/../images/coolnavbutton.gif", the image could wind up missing if it is put it in a directory that was at a different level within the site. A correct path should look something like this:

/images/coolnavbutton.gif

Processing Instructions

The TMPL file includes the processing instructions for the XSL stylesheet declaration to use to create a final page that will be published. This processing instruction for the stylesheet declaration is included in the prolog.

While strict XHTML can be used, the file should not include HTML. All of the HTML structure for a particular template fileset belongs in the XSL file.

OUC Tagging

In addition to the XML and echo var statements, OU Campus tagging style is also used. Previously tags were structured in the form of HTML comments and this is being phased out. The change in style provides greater XML compliance and allows the OmniUpdate tags to be represented as valid XML nodes. For example, currently tags use the following syntax: 

<!-- com.omniupdate.xxx --><!-- /com.omniupdate.xxx -->

While these will still work, the new form of the tag for new implementations is:

<ouc:xxx></ouc:xxx>

There is a transitional form of the tag that is used in current implementations:

<!-- ouc:xxx --> <!-- /ouc:xxx -->

or

<!-- ouc:xxx / -->

For example, rather than:

<!-- com.omniupdate.div label="new_content" group="Everyone" button="707" --><!-- /com.omniupdate.div>

The new tag is:

<ouc:div label="new_content" group="Everyone" button="707">

And the closing tag for the element:

</ouc:div>

All three styles of tagging will work and continue to be supported.

The tags for two elements are auto-updated in current implementations of the OU Campus system. The editor and multieditor tags are converted to the transitional tags. For example, when within an editable region in the WYSISYG editor, saving will generate the intermediary style tag for the editor element for that area. Viewing code within OU Campus shows the tagging style. 

Echo Vars

The TMPL file is an XML document that includes the nodes that will contain the content. It can utilize XHTML, as the document will be well formed. It also includes the tagging for the predefined variables that collect data passed from the TCF. The echo var tag can be usedThe echo var tag is included within HTML comment tags, or OUC tagging style, and uses a system variable to echo, or "print," the value. For example, the Parent variable:

 <!--%echo var="parent" --> 

This prints the path from the site root to the directory that contains the current directory.

They are placed to receive entered information from the TCF file as well as any needed OU Campus tagging. For example:

<!-- com.omniupdate.properties -->
<title><!--%echo var="title" --></title>
<!-- /com.omniupdate.properties -->

In this example, the TMPL echo var will get passed the value of title. The PCF and published HTML file will include the <title> </title> element with the value of the variable. The OU Campus properties tag encloses both the echo var statement and XHTML <title> </title>, indicating it is a page property.

TMPL Example

The following TMPL example is a one-column page layout.

Onecolumn.tmpl Code View
Code View of TMPL File

TMPL Deconstructed

Prolog

<?xml version="1.0" encoding="utf-8"?>
<?pcf-stylesheet path="/_resources/xsl/default.xsl" extension="html"?>
<?pcf-stylesheet path="/_resources/xsl/page2pdf.xsl" extension="pdf" alternate="yes" title="PDF"?>
<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">

Root Node

<document>

Configuration Parameters Code View

In this case the configuration parameters include both a TMPL page type choice as well as the meta tags. They can be edited via page properties.

<config>

<parameter name="pagetype" type="select" group="Everyone" prompt="Page Type" alt="Please choose a appropriate page type">
<option value="article" selected="false">Article</option>
<option value="content" selected="false">Content</option>
<option value="onecolumn" selected="true">One Column</option>
</parameter>

<!-- com.omniupdate.properties -->
<parameter name="keywords" prompt="Keywords" type="checkbox" alt="Pick select the appropriate keywords for the page">
<!--%echo var="keywords" encoding="none" -->
</parameter>
<!-- /com.omniupdate.properties -->

</config>

<metadata>
<!-- com.omniupdate.properties -->
<meta name="Description" content="<!--%echo var="description" -->" />
<meta name="Author" content="<!--%echo var="author" -->" />
<meta name="Keywords" content="" />
<!-- /com.omniupdate.properties -->
</metadata>

Configuration Parameters Page Properties Edit

TMPL Page Properties

Page Title Echo Var

<!-- com.omniupdate.properties -->
<title><!--%echo var="title" --></title>
<!-- /com.omniupdate.properties -->

Page Main Content

In this case, the <content> tag includes a OUC division and editor tag. The new page, upon creation, will have an editable region that allows for the WYSIWYG editor.

<content>
<!-- com.omniupdate.div label="twocolumn_content" group="Everyone" button="700" break="break" -->
<!-- com.omniupdate.editor csspath="/_resources/ou/editor/onecolumn.css" cssmenu="/_resources/ou/editor/styles.txt" width="1050" -->
<h2 class="h-color-link"><!--%echo var="title" --></h2>
<!-- /com.omniupdate.div -->
</content>

Root Node Closing

</document>

Was this page helpful?

Additional Comments:


(Include your email address if you would like a reply)

Procede to http://support.omniupdate.com/