Template Manager Configuration

Template Manager options are set in the Plugin Parameters tab in Editor Profiles

File Directory Path

This is an optional value to set the path to use for the Template Manager. If left blank, the value in the Editor Parameters Filesystem section is used.

Upload File Size

An optional value for the maxiumum file size allowed when uploading. If left blank, the value in the Editor Parameters Filesystem section is used.

Permitted File Extensions

Set the file types that the Template Manager can upload and display. The default types are htm, html, txt.

Filesystem

Set the Filesystem to use for the Template Manager. Leave unselected to use the filesystem set in the Editor Parameters Filesystem section.

Startup Content

Select an html, htm or txt file to load into the editor when a new article is created.

Template List

Enable a dropdown list on the Template Manager button, of custom Template Items, or template files (html, txt, md) in the File Directory Path.

Template Dialog

Open the Template Dialog when clicking on the Template Manager button if the Template List option is enabled. Alternatively clicking the button will open the Template List.

Template Items

Create a list of template content items that can be displayed for selection in a drop-down list on the Template Manager toolbar button. Each item represents a specific template that users can choose from, making it easier to manage and apply different templates.

Template Items

Components of a Template Item

Name

A mandatory field that specifies the name of the template item. The name is used as the title of the item in the drop-down list, and as the title of the variables dialog if the template contains variables.

Thumbnail (optional)

An optional field to provide an identifying thumbnail image for the template item. This image helps users quickly recognize the template.

File

The contents of the template item can be loaded from a file (html, htm, txt, md). Use the File Browser to select the appropriate file by clicking the Select button in the File field.

Custom HTML

Alternatively, you can paste custom HTML content directly into the HTML field.

Variables

If the file content or HTML content contains variables using the format ${Variable} or {$Variable}, a dialog will be shown when the content is inserted into the editor. This dialog will prompt the user to set a value for each variable, using the variable name as the label. For example, inserting a template containing this HTML content:

<div class="custom-template">
  <h1>Welcome, ${Username}</h1>
  <p>Your Staff ID is: ${StaffID}</p>
</div>

will show a dialog prompting the user to enter values for each variable:

Dialog prompting the user to set values for variables

The value entered by the user replaces every occurrence of that variable in the template, so a variable can be used more than once in the same template.

Variable names

Variable names should contain only letters, numbers and underscores, eg: ${StaffID} or ${staff_id}. Names are matched without regard to case. Names containing spaces, hyphens or full stops - eg: ${Staff ID} - will be displayed in the dialog but will not be replaced in the inserted content.

If a language key matching the variable name exists, the translated string is used as the field label, otherwise the variable name is used as-is.

Variables that are defined in the Replacement Values option are substituted automatically before the dialog is displayed, and are not shown as fields for the user to complete.

Variable Types

A variable can be given a type, appended to the variable name with a colon, eg: ${Photo:image}. The type controls the kind of field displayed in the dialog.

Type Example Description
(none) ${Username} A standard single-line text field. This is the default.
image ${URL:image} A url field with a File Browser button for selecting an image. Requires the Image Manager or Image Manager Extended plugin to be enabled.
media ${Video:media} A url field with a File Browser button for selecting a media file. Requires the Media Manager plugin to be enabled.
file ${Download:file} A url field for a file path.
textarea ${Text:textarea} A multi-line textarea instead of a single-line text field.
readonly ${Reference:readonly} A text field whose value can be seen but not edited.
disabled ${Reference:disabled} A text field that is displayed in a disabled state.
hidden ${Size:hidden} A field that is not displayed in the dialog. Useful for values that are set automatically - see below.

Image variable with File Browser button

Textarea variable

Help Text

Help text can be added to any variable by appending it to the variable name with a vertical bar, eg:

${Username|Enter the name to display in the greeting}

The text is displayed as a description beneath the field in the dialog. Help text can be combined with a type, and must come last:

${Photo:image|Select a photograph no wider than 800px}
Automatically Completed Values

When a file is selected using the File Browser button of an image or media variable, details of the selected file are used to complete any other variables in the template that use one of the following reserved names:

  • ${url} - the url of the selected file
  • ${filename} - the name of the selected file without the path or extension
  • ${extension} - the file extension of the selected file, without the leading full stop
  • ${size} - the size of the selected file, formatted as Bytes, KB or MB
  • ${date} - the date the selected file was last modified, using the Modified Date Format option

For example, this template will display a download link that completes itself when an image is selected:

<a href="/${Photo:image}" download="${filename}">${filename} (${extension}, ${size:readonly})</a>

Combine these with the hidden type if you do not want the fields to appear in the dialog at all, eg: ${size:hidden}.

Notes
  • Any HTML entered as a variable value is stripped, and only the text is inserted.
  • On small screens (600px or less) the Template Manager toolbar button opens the File Browser directly instead of the Template Manager dialog.

Content Classes

This is a list of class names, seperated by spaces, used by Templates. When article content is selected and a Template applied, any html within the Template that contains one of these classes, will be applied to the selected content. Example:

selcontent selectedcontent selected

Creation Date Classes

A list of class names separated by spaces. Any Template with one of the classes will have its content replaced by the 'creation' date, formatted according to the Creation Date Format option. A creation date is one that is set if no previous date existed within the element. Once set the original date is stored inside the element in a HTML comment and is designed not to change even with a template change. Example:

cdate creationdate

Modified Date Classes

A list of class names separated by spaces. Any Template with one of the classes will have its content replaced by the 'modified' date, formatted according to the Modified Date Format option. A modified date is one that is updated with each edit. Example:

mdate modifieddate

Creation Date Format

A date format string for the creation date. Example:

%m/%d/%Y : %H:%M:%S

Modified Date Format

A date format string for the modified date. Example:

%m/%d/%Y : %H:%M:%S

Permissions

Set whether the Template Manager can allow uploading, folder creation, folder/file deleting and renaming and file cut/copy/paste options.