By continuing to use this site, you agree to the storing of first- and third-party cookies on your device to enhance site navigation; analyze site, product, and service usage; and assist in our marketing and promotional efforts. Cookie Policy

 
Skip to Content

TMPL

TMPLs (template files) generate new PCF pages when you create new content; they provide the format and structure of the PCF. They have echo variable statements which insert TCF form field inputs into the appropriate locations within the source code on page creation.

TMPL files follow the same page tagging syntax as PCFs.

PrologLink to this section

The prolog is defined at the start of the TMPL and includes three declarations.

XML Declaration

Declares the version and default character encoding of XML used in the document.

<?xml version="1.0" encoding="UTF-8"?>

PCF Stylesheet Declaration

Declares the XSL file which transforms the XML content into its rendered version.

<?pcf-stylesheet path="/_resources/xsl/interior.xsl" title="HTML" alternate="yes" extension="html"?>
  • path (required): root relative path to the appropriate page-type XSL file.
  • title (optional): given name of the page product created from this PCF stylesheet. If not given, the extension is used as the title.
  • alternate: allows the page product of this PCF stylesheet to be viewable in Preview. Options are "yes" and "no". The first PCF stylesheet declared is automatically viewable in Preview. This attribute is only required on subsequent declarations if more than one PCF stylesheet declaration exists.
  • extension (required): defines the file extensions of the page product of this PCF stylesheet. This is used as the title when title is empty.
  • params (optional): defines parameters that can be accessed in the XSL but must be declared in the XSL to use them. Multiple params should be separated by a semi-colon and in the format of name=value;.

Params Example

<?pcf-stylesheet path="/_resources/xsl/interior.xsl" params="image=test.jpg;caption=My Caption" extension="html"?>

Doctype Declaration

Declares the document type, root element name and where the entity conversation file exists.

<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">

Echo Variable Statements Link to this section

Values input into the form fields generated by a TCF are passed to the source code of the TMPL using <!--%echo var="variable name" --> statements. The no space before the percentage and the one space after the last double quote are important.

<title><!--%echo var="title" --></title>
<meta name="Description" content="<!--%echo var="description" -->" />
<meta name="Keywords" content="<!--%echo var="keywords" -->" />
Attribute Example Description Values
var="variable name" References the unique name of a TCF <variable>. Should not contain a space. A system or TCF-defined variable
encoding="none" Turns encoding off for TCF variables that were sent with the output="xml" attribute. "none"

If the variable, defined in the TCF or otherwise, has the output attribute set to "xml," then encoding must be set to "none" in the TMPL for the feature to return the proper value. This outputs all option nodes, instead of just the text value of the selected option.

System Variables

You may also echo any of the system-defined variables such as:

<!--%echo var="ou:dirname" -->

<!--%echo var="ou:path" -->

Syntax Description Example
var="currentdate" Outputs the date and time the page is created.
<parameter name="datetime" prompt="Date created" alt="Date created.">
<!--%echo var="currentDate" --></parameter>
var="commontree" Outputs the name of the current folder.
<a href="/<!--%echo var="commontree" -->/index.html">
var="current" Outputs a path to the current folder from the site root.
<meta name="keywords" content="<!--%echo var="current" -->">
var="directory" Outputs a path to the current folder from the site root, followed by a slash.
<a href="/<!--%echo var="directory/" -->index.html">
var="includes" Outputs the path from the site root to the parent folder and adds a trailing "includes" folder.
<a href="<!--%echo var="includes" -->/leftnav.html">
var="parent" Outputs the path from the site root to the folder that contains the current folder.
<a href="/<!--%echo var="parent" -->index.html">
var="relativeroot/" Outputs the relative path from the current folder to the staging root, i.e. ../../currentfolder/.
<config><!--%echo var="relativeRoot/" -->resources/config/standard.xml</config>
var="sitename" Outputs the name of the current site.
This page is part of the <!--%echo var="sitename" --> site.

Example TMPL Link to this section

<?xml version="1.0" encoding="UTF-8"?>
<?pcf-stylesheet path="/_resources/xsl/interior.xsl" title="HTML" extension="html"?>

<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd"> 

<document xmlns:ouc="http://omniupdate.com/XSL/Variables">

	<ouc:properties label="metadata">
		<title><!--%echo var="title" --></title>
		<meta name="Description" content="<!--%echo var="description" -->" />
		<meta name="Keywords" content="<!--%echo var="keywords" -->" />
	</ouc:properties>

	<ouc:properties label="config">
		<parameter name="heading" type="text" group="Everyone" prompt="Page Heading" alt="Please enter the page heading."><!--%echo var="title" --></parameter>
		<parameter name="breadcrumb" type="text" group="Everyone" prompt="Breadcrumb" alt="Please enter the breadcrumb text. This is not used on index pages."><!--%echo var="title" --></parameter>
	</ouc:properties>

	<ouc:div label="maincontent" group="Everyone" button-text="Main Content">
		<ouc:editor csspath="/_resources/ou/editor/wysiwyg.css" cssmenu="/_resources/ou/editor/styles.txt" wysiwyg-class="maincontent"/>
	</ouc:div>

</document>