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.
Components of a Template Item:
- Name:
- A mandatory field that specifies the name of the template item.
- 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, tx, 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.
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 that 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:
A variable can also accept one of 3 media types - image, media and file - which will add a File Browser button to the text field allowing the user to select a file of that media type. The media type is appended to the variable with a colon, eg: ${URL:image}
will add a Flie Browser button to select an image.
In a similar way, adding textarea to a variable, eg: ${Text:textarea}
will display a multiline textarea instead of a single line text field.
Replacement Values
This option allows you to set Name : Value pairs where the Name is a classname or variable in the template HTML, and the Value is the replacement for this variable. This enables dynamic content substitution in your HTML templates based on the provided Name : Value pairs.
In the fields provided, enter a Name and Value for each pair. The Name can be a classname or a variable in the template HTML, and the Value is the text that will replace the variable. Click the Plus button to create a new pair, or the Trash button to delete an existing pair.
For example, setting the following pairs:
- Name: username
- Value: Joe Blogs
- Name: staffid
- Value: 991234
The variable {$username}
or ${username}
in the template HTML will be replaced with the value "Joe Blogs" and the variable ${staffid}
will be replaced with "991234"
Original HTML
<p>Username: ${username}</p>
<p>Staff ID: ${staffid}</p>
Resulting HTML
<p>Username: Joe Blogs</p>
<p>Staff ID: 991234</p>
Similarly, any HTML tag with the class name username
will have the value "Joe Blogs" inserted into it, and the class name staffid
will have the value 991234 inserted into it.
Original HTML
<p class="username"></p>
<p class="staffid"></p>
Resulting HTML
<p class="username">Joe Blogs</p>
<p class="staffid">991234</p>
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.