Building blocks of templates in helpdesk and editing support available
Template sets in helpdesk are built upon Dwoo Template Engine. HTML and JavaScript codes are supported for modification. HTML comments are used for commenting in code. JavaScript is not supported in email-specific templates and HTML is not supported in email templates which are meant for text content.
The PHP code can be enabled for templates by On Premise clients by un commenting the following constant in config.php under __swift\config
in the document root of helpdesk:
//define('SWIFT_ENPHP_TEMPLATES', true);
Templates in helpdesk consist of the following building blocks:
Variables contain values for various properties that are based in real-time and can be used as such or with logical conditions per the requirement. These variables are specified and assigned to a template in the source code.
When working in an inactive template group, you can view assigned variables for a template by adding <{dump}>
variable to the relevant template and then viewing the output on relevant location on Support Center or in an email dispatched by helpdesk.
The <{dump}>
variable contains sensitive information and we strongly suggest that this is NEVER EVER used on a live template group.
Types of variables:
- Stand-alone variable
<{$variablename}>
For example:
<{$_templateGroupPrefix}>
- Variables stored in a container (array)
<{$containername[element]}>
For example:
<{$_languageItem[isenabled]}>
- Language phrase variables
Language phrases available in language packs (identified by identifier value) can be referred to in templates by following a generic format:
<{$_language[identifier}>
For example:
<{$_language[arintro]}>
Language phrases can be added to an existing language pack via Insert Phrase button from Admin > Options > Languages > Phrases.
We recommend inserting a new phrase with a unique identifier to all language packs in your helpdesk to ensure that language selection does not affect language phrase from getting called or does not result in an undefined index error.
All variables (including language phrase variables) are case-sensitive.
You can make use of if-else statements making use of variables matching using logical operators to control the display of particular sections of code.
Generic format for if-else:
<{if $variable operator ‘value1’}>
<{elseif $variable operator ‘value2’}>
//Code block to be executed
<{/if}>
An example:
_activeLanguageID
variable contains language ID selected for Support Center. This piece of code, for example, can be placed in the header template.
<{if $_activeLanguageID == '1'}>
You are currently browsing in ‘English (U.S.)’
<{elseif $_activeLanguageID == '2'}>
You are currently browsing in ‘Deutshe (de)’
<{else}>
You are browsing but not in ‘English (U.S.)’ or ‘Deutsch (de)’ language
<{/if}>
On Premise clients can check compiled Dwoo-specific functions from under __swift\thirdparty\dwoo\plugins\builtin
in the document root.
Dwoo provides documentation for blocks and functions.
An example
You can display Reply due counter to a client (making use of date_format
function), by adding this piece of code to the viewticket template under Ticket group:
<{$_ticket[duetime]|date_format: "%A, %B %d, %Y %R %Z"}>