TCFs
TCFs, or Template Control Files, contain instructions for building out a new page, file, or section, and create the form that user fill out when creating a new page. These files have the extension .tcf
and are edited in the source editor. TCF files specify which form fields will be presented during the new template creation, whether a new folder should be created, which TMPL files will be utilized, and what actions should be taken on a navigation file.
TCFs must begin with a prolog and all -list
nodes must be wrapped in a <tcf>
node. There are four possible -list
nodes which can be included in a TCF.
Variable ListLink to this section
The <variable-list>
node contains <variable>
elements. Each <variable>
element specifies a form field prompt which displays during the new template creation. There is no limit to the number of <variable>
elements listed, save for usability. Inputs from the form fields created by <variable>
elements can pass text, asset, asset, or file path values to the source code of the TMPL or to an RSS item.
Here is an example of a variable list in a TCF:
<variable-list>
<!-- general page setup -->
<variable section="General Page Setup" name="title" type="text" prompt="Page Title" alt="Required Field. Enter the page title. This will be used by search engines and will also display below the breadcrumb.">Page Title</variable>
<variable name="description" type="text" rows="3" prompt="Description" alt="Important. Enter a short description of the page, to be displayed by search engines."></variable>
<variable name="keywords" type="text" rows="3" prompt="Keywords" alt="Add keywords to describe key topics on your page. (For limited SEO purposes)."></variable>
<variable name="tags" type="tag" prompt="Tags" alt="Choose Tags to be added to the page. These can be updated in page properties to add more later."></variable>
<variable section="File Configuration" name="autonavigation" prompt="Add Navigation Item" type="select" alt="Specify if a link to this page should be added to the navigation. Note that both files need to be published after creation.">
<option value="true">Yes</option>
<option value="false">No</option>
</variable>
<!-- A safer way to create a file, forces PCF file extension -->
<variable name="pcf-filename" prompt="Filename" alt="Enter a filename using only lowercase letters, underscores, or dashes">untitled</variable>
<variable name="tcfname" type="text" display="none">interior.tcf</variable>
</variable-list>
And this is the form a user creating a new page would see:
Template ListLink to this section
The <template-list>
node contains <template>
elements. Each <template>
element specifies a TMPL file which will be used during the new template creation. There is no limit to the number of <template>
elements listed. TCFs which generate new sections often have multiple <template>
elements allowing for the creation of multiple files. Many implementations include creation of an index page, a side navigation file, and a props file, though this varies based upon your website design. More than one TCF can point back to the same TMPL. Attributes defined in a <template>
element can toggle the display of system generated form fields (for example overwrite or access group) as well as define the value for these fields.
Here is an example of a template list in a TCF:
<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>
This template list combines values entered into the TCF (values enclosed by {curly brackets}) with the TMPL specified (interior.tmpl
) to create a PCF.
Directory ListLink to this section
The <directory-list>
node contains <parent>
elements. Each <parent>
element specifies the path to a specific folder. Contained within each <parent>
element are <directory>
elements. Each <directory>
element defines a new folder to be created during new template creation. TCFs which generate new sections define the new folder using a <directory>
element. A directory list is not required for a functional TCF.
Here is an example of a directory list in a TCF:
<directory-list>
<parent name="current_folder" path=".">
<directory name="new-folder" template-group="*inherit*">folder_name</directory>
</parent>
</directory-list>
This will generate a folder in the current directory (path="." )
, named folder_name
, which will inherit the template group assigned to its parent folder (template-group="*inherit*")
.
To assign a variable name from the variable list to the newly generated folder, enclose the variable name in {curly braces}, like so:
<directory name="new-folder" template-group="*inherit*">{variable-name}</directory>
Navigation ListLink to this section
The <navigation-list>
node contains <navigation>
elements. Each <navigation>
element specifies an action, or lack thereof, to be taken. While multiple <navigation>
elements can be included, only one will be executed during the new template creation. For many implementations, there is an "Add Navigation Item" dropdown in the <variable-list>
. There are then two <navigation>
elements; one to be executed if the dropdown was set to "yes," and a second to execute if the dropdown was set to "no."
Here is an example of a navigation list in a TCF:
<navigation-list>
<!-- navigation options and link style -->
<include>_navigationlist.inc</include>
</navigation-list>
This example adds a navigation item to _navigationlist.inc
, should the editor filling out the TCF choose to create a new navigation item.