Template
The template object provides access to properties/settings defined within the Template Config file at runtime.
Instantiation
Template objects are automatically supplied at runtime, but can be instantiated manually if necessary.
<?ev
var default_template = new Template('page/index');
?>
Construct parameters |
---|
reference
String
The reference must be a valid template reference, which is made up of controller/identifier.
|
Properties |
---|
assets
Array
Containing String asset identifiers available to pages with this template. Assets and asset identifiers are defined within the Template Config file i.e. you have full control over what assets are and what they can be used for. |
children
Array
| Boolean
By default this property has a Boolean value of true, meaning that pages with this template may contain any sub-page with the same controller. If set to false pages with this template may not have sub-pages. This property can contain an Array of template identifiers with the same controller. Note that children identifiers must have the same controller, so a "page" controller may not have a child document that is a "category". The value for this property is set within your Template Config file. This property is available for the following controllers:
Note: category controller only currently supports a true value. |
id
String
The identifier string for the current template. |
path
String
The raw path as set within the config/templates.json file.
|
perpage
Number
Default value is zero - view all child pages. When greater than zero pages with this template will support pagination and filtering by tag, date, or author of child pages. This property is available for the following controllers:
|
settings
Object
Contains properties defined with a "template" scope within the Template Config file. The best way to visualise this is with an excerpt from config/templates.json settings file for a page with properties.
...and then the resulting setting object:
This property is currently available to the following controllers:
|
sort
String
Contains the sort order for the current Page template. The sort string is comprised of column:direction. Available settings can be found on the Template Config page. This property is currently available to the following controllers:
Note that category sort order is managed within Evance itself per category and you do not need to set it in your Template Config. |
tags
Array
Contains an Array of String identifiers representing each TagType supported by the template. This property is currently available to the following controllers:
|
title
String
The name of the template. |