Converting the PCF to a TMPL

After configuring the PCF to have all necessary parameters and node configuration, convert the PCF to a TMPL. This requires very little extra work. TMPLs are the templates for the files created by the TCF. For pages, these are configured identically to PCFs with one change. Instead of having hard-coded content, within the TMPL there are echo variables that echo in content from the TCF. It is also possible to have some example content in the editable regions, or just empty editable regions.

Note: It is important to note that any include files, such as the side navigation and breadcrumb files, created with a new section will need to have TMPLs as well. These can then be triggered by the New Page Wizard. These files are generally pretty simple, and a couple of examples (leftnav.tmpl and properties.tmpl) follow the explanation of converting the PCF to a TMPL below.

For the purposes of this demonstration, the description entered into the TCF is echoed into the main content area. Additionally, the title is echoed into both the <title> node and the editable region for the page heading. The parameters and other meta data will also be echoed.

The syntax for an echo variable is:

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

The value for the variable should match the name of the variable in the TCF. If options are being included, for instance when making a page type selection, encoding="none" needs to be included in the echo statements in order to have the proper XML syntax passed.

There are also system-defined variables, which exist regardless of the variables in the TCF. These include options such as the root relative path, the site name, and current directory. For a full list of system-defined echo variables, visit the Support site, and navigate to Development > Template Files > TMPL Reference.

For this demonstration, make the changes highlighted below:

Highlighted Echo Var Source Codes

Current Code
<?xml version="1.0" encoding="utf-8"?>
<?pcf-stylesheet path="/_resources/xsl/default.xsl" extension="html" title="Web"?>
<?pcf-stylesheet path="/_resources/xsl/page2pdf.xsl" extension="pdf" alternate="yes" title="PDF"?>
<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">
 
<document>
     
<!-- ouc:properties -->
<config>
      <parameter name="pagetype" type="select" group="admin" prompt="Page Type" alt="Please choose a appropriate page type">
            <option value="article" selected="false">Article</option>
            <option value="content" selected="true">Content</option>
            <option value="onecolumn" selected="false">One Column</option>
      </parameter>
     
      <parameter name="quotes" type="select" group="Everyone" prompt="Student Quotes" alt="Do you want to display the student quotes?">
            <option value="true" selected="true">Yes</option>
            <option value="false" selected="false">No</option>
      </parameter>
     
      <parameter name="keywords" prompt="Keywords" type="checkbox" alt="Pick select the appropriate keywords for the page">
            <option value="Gallena" selected="true">Gallena</option>
            <option value="GU" selected="true">GU</option>
            <option value="Gallena University" selected="false">Gallena University</option>
            <option value="Why Choose Gallena" selected="true">Why Choose Gallena</option>
            <option value="Undergraduate" selected="true">Undergraduate</option>
            <option value="Graduate" selected="false">Graduate</option>
      </parameter>
     
      </config>
     
      <metadata>
            <meta name="Description" content="" />
            <meta name="Author" content="" />
      </metadata>
     
      <title>New Page</title>
<!-- /ouc:properties -->
 
<content>
      <h2 class="h-color-link">
            <!-- ouc:div label="pageheader" group="Everyone" button="862" break="break" --><!-- ouc:editor toolbar="Title Toolbar" csspath="/_resources/ou/editor/pt-title.css" cssmenu="/_resources/ou/editor/pt-styles.txt" width="1042" parag="no"/ -->Creating a New Page II<!-- /ouc:div -->
</h2>
     
      <!-- ouc:div label="maincontent" group="Everyone" button="700" -->
<!-- ouc:editor csspath="/_resources/ou/editor/pt-onecolumn.css" cssmenu="/_resources/ou/editor/pt-styles.txt" width="1042" -->
<p>
      <img style="border: 0pt none; margin: 5px; float: left;" src="/_resources/images/about/gulibrary.jpg" alt="library" width="269" height="227" />
      The mission of the Library organization is to connect students, faculty, staff, and members of the local community with the information resources they need for study, research, and recreation. The library contains substantial collections of books, journals, government documents, videos, maps, and other physical materials, all listed in its online catalog.
      </p>
     
      <p>
            The Library organization provides a wide range of library instruction opportunities to the campus community. For many students the first introduction to library services at GU is through the required library component of University 100, designed to introduce new students to basic concepts of information literacy. Librarians also provide a variety of workshops, as well as individual in-depth consultation focusing on a specific research topic.
      </p>
     
      <p>
            The Library provides adaptive devices to make our print and electronic resources accessible to the disabled and works closely with Disabled Student Services to insure that equipment, facilities, and collections are responsive to special needs.
      </p>
     
      <p>
            For more information about the GU Library, please contact the Campus Librarian at <a href="mailto:library@gallenauniversity.com?subject=GU%20Library%20Information">library@gallenauniversity.com</a>.
      </p> <!-- /ouc:div -->
</content>
</document>
New Code
<?xml version="1.0" encoding="utf-8"?>
<?pcf-stylesheet path="/_resources/xsl/default.xsl" extension="html" title="Web"?>
<?pcf-stylesheet path="/_resources/xsl/page2pdf.xsl" extension="pdf" alternate="yes" title="PDF"?>
<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">
 
<document>
      <!-- ouc:properties -->
      <config>
            <parameter name="pagetype" type="select" group="admin" prompt="Page Type" alt="Please choose a appropriate page type">
                  <!--%echo var="pagetype" encoding="none" -->
            </parameter>
     
            <parameter name="quotes" type="select" group="Everyone" prompt="Student Quotes" alt="Do you want to display the student quotes?">
                  <!--%echo var="quotes" encoding="none" -->
            </parameter>
     
            <parameter name="keywords" prompt="Keywords" type="checkbox"  alt="Pick select the appropriate keywords for the page">
                  <!--%echo var="keywords" encoding="none" -->
            </parameter>
      </config>
      <metadata>
            <meta name="Description" content="<!--%echo var="description" -->" />
            <meta name="Author" content="<!--%echo var="author" -->" />
      </metadata>
     
      <title><!--%echo var="title" --></title>
      <!-- /ouc:properties --> 

      <content>
            <h2 class="h-color-link">
                  <!-- ouc:div label="pageheader" group="Everyone" button="862" break="break" --><!-- ouc:editor toolbar="Title Toolbar" csspath="/_resources/ou/editor/pt-title.css" cssmenu="/_resources/ou/editor/pt-styles.txt" width="1042" parag="no"/ -->
                        <!--%echo var="title" -->
                  <!-- /ouc:div -->
            </h2>
                 
            <!-- ouc:div label="maincontent" group="Everyone" button="700" -->
            <!-- ouc:editor csspath="/_resources/ou/editor/pt-onecolumn.css" cssmenu="/_resources/ou/editor/pt-styles.txt" width="1042" -->
                  <!--%echo var="description" -->
            <!-- /ouc:div -->
      </content>
</document>

After making the described changes, save the file as a TMPL with a new path and update the name to pt-new-page.tmpl. The new path is /_resources/ou/templates, which is the path to where the page templates (TCFs and TMPLs) exist.

Original Path

Original Path with PCF Extension

New Path

New Path with TMPL Extension

Examples of Other TMPLs

In order to have additional files created, such as the side navigation and breadcrumb files, TMPLs need to be created for those as well. This is generally done one time initially, and then the same files are used in all necessary sections created in the future.

The following two examples depict the TMPLs for the leftnav.tmpl and properties.tmpl files that are created with a new section for Gallena University’s templates.

LEFTNAV.TMPL

The leftnav.tmpl creates a basically empty file with only an editor tag. Any necessary div tags for making the file appear as an editable region are in the XSL. The code to be added to the file to create new navigation items is entered upon new page creation via the TCF.

<!-- ouc:editor csspath="/_resources/ou/editor/leftnav.css" width="950" / -->

PROPERTIES.TMPL

The properties.tmpl is, in this case, used to create the breadcrumb file. This particular TMPL creates a Page Property that makes editing the breadcrumb title user friendly.

<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">
<html>
<head>
<title>
Breadcrumb Name
</title>
<!-- ouc:properties -->
Current Breadcrumb Name: <parameter name="breadcrumbs" type="text" group="Everyone" prompt="Breadcrumb Name" alt="Please provide a friendly breadcrumb name"><!--%echo encoding="none" var="breadcrumb" --></parameter>
<!-- /ouc:properties -->
</head>
<body>
<h3>Please click the page properties (<img src="/_resources/images/properties_icon.jpg" alt="pp" style="position: relative; top: 13px;padding-left: 5px;padding-right: 5px;"/>) icon to change the default breadcrumb name for the current folder</h3>
</body>
</html>