Start a conversation

Understanding How Custom Templates Work

Overview

In this article, you will find information about the commonly used template sets, their purpose, and how they can be applied to your system.

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

Information

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

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.

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 the 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  
viewtickets_list Ticket list display
email_*
For example,  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 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 uncommenting the following constant in config.php under __swift\config in the document root of helpdesk:

//define('SWIFT_ENPHP_TEMPLATES', true);

Templates in helpdesk consist largely 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.

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 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 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 does not affect language phrase from getting called or does not result in an undefined index error.

Note: 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 the 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 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}>

Blocks and Functions

On Premise clients can check compiled Dwoo-specific functions from under __swift\thirdparty\dwoo\plugins\builtin in the document root.

A live 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"}>
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted
  3. Updated

Comments