TMPLs
TMPLs, or template files, are most commonly used to create PCF pages, but can actually be set up to create any kind of file type. They use the .tmpl
extension and are edited in the source editor.
TMPL files work in concert with TCF files. A TMPL contains the structure of the file to be made, with echo variable statements marking out the places for content. Then, when a user fills out the TCF, the TCF passes that data to the corresponding statements.
Echo variable statements look like this: <!--%echo var="title" -->
. The %echo
tag allows property data to be represented in the code from the form. var
is the attribute to which you assign the name of the property you would like the value of. In this example, the echo variable statement is a placeholder that will be replaced by the value the user enters in the "Title" form field on the TCF.
The full code in the TMPL file would look like this: <title><!--%echo var="title" --></title>
And the corresponding code in the PCF the TMPL creates after a user enters a title would look like this: <title>Clubs & Organizations</title>
When building a TMPL, you can fill it out with as little or as much starting data as you want.
The following is a sample TMPL:
<?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">
<headcode></headcode> <!-- before closing head tag -->
<bodycode></bodycode> <!-- after opening body tag -->
<footcode></footcode> <!-- before closing body tag -->
<ouc:info><tcf><!--%echo var="tcfname" --></tcf><tmpl>interior.tmpl</tmpl></ouc:info>
<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>
<!--
<ouc:div label="additional-content" group="Everyone" button-text="Additional Content">
<ouc:editor csspath="/_resources/ou/editor/wysiwyg.css" cssmenu="/_resources/ou/editor/styles.txt" wysiwyg-class="additional-content"/>
</ouc:div>
-->
</document>
The elements of this TMPL are:
- Lines 1-4: These elements form the prolog of the PCF.
- Line 6: This is the root element of the PCF.
- Lines 8-11: These nodes are not required, but are a place for you to add page-specific resources such as CSS or JS. These are not official system elements, and are only utilized if the XSL is configured for them.
- Lines 13-17 and 19-22: The tags here set the page parameters for the PCF.
- Lines 24-26: This is the main editable region of the page.
- Lines 28-32: This is an additional editable content region that is currently commented out. Commented-out sections of TMPLs do not appear in PCFs created from that template.