Start a conversation

Understanding how custom templates work

We're actively rewriting our user guide, so check back for improved coverage.

Note: We strongly recommend test out any template customizations on a template group which has been added solely for testing purpose (and hasn’t been announced publicly). This ensures that any tweak can tested and final results are visible to you prior to applying the changes to a live template group.

A template group consists of a set of templates dealing with front-end layout, design and outgoing emails. Template sets can be accessed via Admin interface > Options > Templates > Templates

 

We have compiled a handy list of commonly used template sets, important templates they contain and purpose of those templates for your reference.

Template set
Contains
Important templates
Purpose
General
Templates dealing with support center layout and those templates which are not app specific.
header
Support Center header (general layout of elements)
clientcss
Original CSS file for a template group. Controls the look and feel of template group.
customcss
Empty CSS file. Any code entered here overrides original code specified in clientcss. Learn more
emailnotification_html emailnotification_text
Staff notification email. Check available variables here.
Tickets
Ticket submission and outgoing ticket app specific emails
submitticket_departments
Department selection page on Support Center
submitticket_form
Ticket submission form
viewticket
Ticket display
viewtickets_list
Ticket list display
email_*
 For e.g. email_autoresponderhtml
Outgoing emails. Name imply their purpose. HTML is only allowed in templates ending with HTML postfix.
Live Support
Live chat badges and chat window specific templates
chatheader
Chat window header (general layout of elements)
chatlanding
Online chat window
leavemessage
Offline chat window
proactivechatdiv
Proactive chat box
chatbadge
Site badge
chatimage
Live chat button

 

Building blocks of templates in helpdesk and editing support available

Template sets in helpdesk are built upon Dwoo Template Engine. HTML and JavaScript code 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.

PHP code can be enabled for templates by On Premise clients by uncommenting following constant in ‘config.php’ under ‘__swift\config’ in document root of helpdesk

//define('SWIFT_ENPHP_TEMPLATES', true);

Templates in helpdesk consists of largely 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 source code. 

When working in an inactive template group, you can view assigned variables for a template by adding <{dump}> variable to relevant template and then viewing the output on relevant location on Support Center or in email dispatched by helpdesk.

NOTE: The <{dump}> variable contains sensitive information and we strongly suggest that this is NEVER EVER used on a live template group.

Stand-alone variable 

<{$variablename}> 

For e.g. <{$_templateGroupPrefix}> 

Variables stored in container (array)

<{$containername[element]}>

For e.g. <{$_languageItem[isenabled]}>

Language phrase variables

Language phrases available in language packs (identified by ‘identifier’ value) can be referred to in templates via following generic format:

<{$_language[identifier}>

For e.g. <{$_language[arintro]}>

Language phrases can be added to an existing language pack via ‘Insert Phrase’ button from Admin interface > 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 doesn’t affect language phrase from getting called or doesn’t result in an undefined index error. 

All variables (including language phrase variables) are case-sensitive.

Logical conditions

You can make use of if-else statements making use of variables matching using logical operators to control display of particular sections of code.

Generic format for if-else:


 <{if $variable operator ‘value1’}>

//Code block to be executed

<{elseif $variable operator ‘value2’}>

//Code block to be executed

<{/if}>

 

A live example

‘_activeLanguageID’ variable contains language ID selected for Support Center. This piece of code for example can be placed in ‘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}>

Blocks and Functions

On Premise clients can check compiled Dwoo specific functions from under ‘__swift\thirdparty\dwoo\plugins\builtin’ in document root. Dwoo provides documentation for blocks and functions

A live example

You can display Reply due counter to a client (making use of date_format function), via adding this piece of code to ‘viewticket’ template under ‘Ticket’ group 

<{$_ticket[duetime]|date_format: "%A, %B %d, %Y %R %Z"}>

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Sukhpreet Anand

  2. Posted
  3. Updated