Creating a Page Template
Templates in Modern Campus CMS generate new pages or sections via a form interface. In Content > Pages, click +New for a dropdown of pre-existing templates. Templates are generated from a combination of three files working together:
- Image: The thumbnail image uploaded to the "New Content" box.
- Template Control File (TCF): The form fields a user fills out that direct the content to the appropriate template file(s).
- Template File (TMPL):The layout for the new page or file that accepts the inputs from TCF form fields.
ImageLink to this section
You can use any image file type for the thumbnail image. Match the name of the image file to the name of the TCF to properly associate the files (for example, interior.jpg
for the image file and interior.tcf
for the TCF). You can also choose an image in Setup > Templates.
TCFLink to this section
The TCF supplies the form field prompts a user sees during new page/section creation and contains execution instructions on how to use the inputs given. There are four possible -list
nodes that can be included in a TCF.
Variable
The <variable-list>
defines the form fields included in the prompts when a new page/section is created. Place a <variable-list>
node inside a TCF with a separate <variable>
node for each form field prompt.
In the <variable>
node, include the type
attribute to specify the type of form field. There are eleven types of form fields available, each with their own set of attributes.
- 1. Asset Chooser
- 2. Checkboxes
- 3. Date Picker
- 4. Date/Time Picker
- 5. File Chooser
- 6. Radio
- 7. Select (Dropdown)
- 8. Tags
- 9. Text
- 10. Text Area
- 11. Time Picker
The content editor chooses from the list of available assets.
The content editor selects one or more options from a list.
The content editor chooses a date on the calendar.
The content editor chooses a date on the calendar and a time of day.
The content editor chooses a file from those available in the Modern Campus CMS file system.
The content editor chooses an option from a dropdown menu.
The content editor chooses a tag.
The content editor enters text.
The content editor enters text, but in a larger space.
The content editor chooses a time of day.
The following 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. Place a <template-list>
node inside a TCF with a separate <template>
node for each TMPL.
The following 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 the folders that are created when the TCF is executed. Place a <directory-list>
node inside a TCF. Inside of that node, place a <parent>
node to define where the new folder is created. Inside of <parent>
, place a <directory>
node to define the actual folder.
The following 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>
updates the navigation files when a TCF is executed. Place a <navigation-list>
node inside a TCF with a single <navigation>
node for each navigation option defined. Only one navigation update can be made by a TCF.
The following 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>
TMPLLink to this section
The TMPL accepts the inputs entered into TCF form fields and employs <!--%echo var="..." -->
statements to direct inputs to the appropriate locations within the source code. Structure the TMPL to mirror the final page/file output of the template creation process.
The following 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" -->" />