TMPL Attributes Reference Guide
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. |
|
var="commontree" | Outputs the name of the current folder. |
|
var="current" | Outputs a path to the current folder from the site root. |
|
var="directory" | Outputs a path to the current folder from the site root, followed by a slash. |
|
var="includes" | Outputs the path from the site root to the parent folder and adds a trailing "includes" folder. |
|
var="parent" | Outputs the path from the site root to the folder that contains the current folder. |
|
var="relativeroot/" | Outputs the relative path from the current folder to the staging root, for example ../../currentfolder/ . |
|
var="sitename" | Outputs the name of the current site. |
|
Example TMPL Link to this section
<?xml version="1.0" encoding="UTF-8"?>\n<?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>