Skip to Content

Creating a Page Template

Templates in OU Campus generate new pages or sections via a form interface. In Content > Pages, click on the +New button for a dropdown of pre-existing templates. These templates are generated from a combination of three files working together:

  • Image: The thumbnail image used in the New Content box.
  • Template Control File (TCF): The form fields a user fills out when making new content that directs the inputs to the appropriate template file(s).
  • Template File (TMPL): The layout for the new page or file that accepts the inputs from template control file form fields.

ImageLink to this section

You can use any image file type for the thumbnail image. The name of the image file needs to match the name of the TCF to be properly associated (e.g. interior.jpg for the image file and interior.tcf for the TCF). Otherwise, you can explicitly choose an image in Setup > Templates.

Template Control File (TCF)Link to this section

The TCF supplies the form field prompts seen during new page/section creation and contains execution instructions on how to use the inputs given. You can find up to four different lists contained within a TCF.

Variable

The variable list defines the form fields included in the prompts when a new page/section is being created. This list is generated by placing a <variable-list> node inside a TCF with a separate <variable> node for each form field prompt.

On the <variable> node, you can include the type attribute, which specifies the type of form field. There are eleven types of form fields available, each with their own set of attributes.

  1. Asset Chooser
    Asset Chooser
  2. Checkboxes
    Checkboxes
  3. Date Picker
    Date Picker
  4. Date/Time Picker
    Date/Time Picker
  5. File Chooser
    File Chooser
  6. Radio
    Radio
  7. Select (Dropdown)
    Select (Dropdown)
  8. Tag
    Tag Chooser
  9. Text
    Text
  10. Text Area
    Text Area
  11. Time Picker
    Time Picker

Below is an example of a variable list:

<variable-list>
	<variable section="New Page Information" name="page-title" type="text" group="Everyone" prompt="Page Title" alt="Enter the title for this page">Page Title</variable>
</variable-list>

Template

The template list references the template file(s) (TMPL) used when the TCF is executed. This list is generated by placing a <template-list> node inside a TCF with a separate <template> node for each TMPL.

Below is an example of a template list:

<template-list>
		<template 
				  prompt-prefix="File"
				  filename="{pcf-filename}"
				  display-filename="no"
				  extension="pcf"
				  preferred-redirect="yes"
				  tags="{tags}"
				  autonav="{autonavigation}">interior.tmpl</template>
	</template-list>

Directory

The directory list defines folders created when this TCF is executed. This list is generated by placing a <directory-list> node inside a TCF. Inside of that node, a <parent> node is placed to define where the new folder is created. Inside of that, a <directory> node defines the actual folder.

Below is an example of a directory list:

<directory-list>
   <parent name="current_folder" force-lowercase="no" path=".">
      <directory name="images" prompt-prefix="New Section" rss-feed="*inherit*" force-lowercase="yes" display-group="yes" template-group="*inherit*" publish="yes">{dirname}/images</directory>
   </parent>
</directory-list>

Navigation

The navigation list defines updates to be made to navigation files when a TCF is executed. This list is generated by placing a <navigation-list> node inside a TCF with a single <navigation> node appearing for each autonav option defined. Only one navigation update can be made by a TCF.

Below is an example of a navigation list:

<navigation-list>
	<navigation name="true" path="_nav.inc" publish="no"><li><a href="{ox_autonav:shorturl}">{title}</a></li></navigation>
	<navigation name="false" path="_nav.inc" publish="no"></navigation>
</navigation-list>

Template File (TMPL)Link to this section

The TMPL is structured to mirror the final page/file output of the template creation process. It accepts the inputs entered into TCF form fields during this process and employs <!--%echo var="..." --> statements to direct those inputs into the appropriate locations within the source code.

Below is an example of an <!--%echo var="..." --> statement:

<title><!--%echo var="title" --></title>
<meta name="Description" content="<!--%echo var="description" -->" />
<meta name="Keywords" content="<!--%echo var="keywords" -->" />