Template field definitions

This file is required, and should match the name of the .tmpl file, for example template1.tmpl and template1.php

A $template array defines some basic template parameters:

$template['name'] = 'Name of template';
$template['description'] = 'Description of template';

A $templatefield array defines each editable region within the page, each region being an entry within the array, which is itself an array containing a number of parameters telling Unicity CMS about the editable area.

At a minimum, a field definition will consist of a merge tag, title and type, for example:

$templatefield[] = array('mergeTag' => 'HeaderContent', 
                         'title' => 'Header Content', 
                         'type' => 'text');

Many additional options may be passed into a template, which enhance the editing experience, and are strongly recommended.

Required template field definitions

mergeTag

This is the internal name of the field. It can be any alphanumeric string, however it can't contain spaces or special characters. 

title

This is the field title that is displayed to the user within the editor. Can be any alphanumeric string and can contain special characters.

type

This defines the type of the field and can be any of the following: text, image, link, checkbox, select, selectsql or repeatable. These are described below, along with their optional parameters.

Optional template field definitions

There are a number of common parameters, that are available for most field types. 

tab

If not set, the editor field will appear on the first "Content" tab within Unicity CMS. If set, a tab will be created with the value given here. Can contain letters, numbers and spaces.

It is recommended that fields are broken down and grouped into appropriate tabs to make it easier for a user to see what they need to complete.

width and height

Integer. These are used to set the width and height of text areas, or images.

html 

Allows HTML to be output inside the field's DIV, can be used for notes or custom functionality.

Field types

The following field types are available. Some field types have additional parameters available:

  • text
  • image
  • link
  • checkbox
  • select
  • selectsql
  • repeatable
  • repeatabletype