OTRS - Manual
Prev |  | Next

# Chapter 16. Customize the frontend

It's possible to customize the frontend independently from OTRS releases. How? It's quite simply. The magic key is dtl (Dynamic Template Language). All frontend masks are located under ~otrs/Kernel/Output/HTML/<THEME>/*.dtl. Default is the "Standard" Theme.

So you have the power to customize each OTRS side like you want! Or to create new themes.

# The dtl syntax

Comment

Comment is a simple '#'.

    # --
    # this is a comment
    # --

Set a variable

    <dtl set $Data{"Test1"} = "German">

Note: $Data{"xyz"} exists only the current dtl file and $Env{"xyz"} exists the whole dtl files. New: $Config{"xyz"} is not read only anymore and exists the whole program! (2002-05-22 / 0.5 BETA5)

Print a variable

To print a variable on the screen, use simply:

    $Data{"xyz"} or $Env{"xyz"}

Text translations

    $Text{"This should be translated"}

Take care, that the translation exists in the "$HOME_OTRS/Kernel/Language/*.pm" files. If there isn't a translation, the given text will be shown.

Condition

    <dtl if ($Text{"Lock"} eq "Lock") { $Data{"FrontendLanguage"} = "English"; }>

It's only possible to store things into $Data{"xyz"} and $Env{"xyz"}.

Get a config option - $Config{}

    $Config{"Sendmail"}

Common environment variables - $Env{}

        $Env{"SessionID"} --> the current session id
        $Env{"Time"} --> the current time e. g. 'Thu Dec 27 16:00:55 2001'
        $Env{"CGIHandle"} --> the current CGI handle e. g. 'index.pl'
        $Env{"UserCharset"} --> the current site charset e. g. 'iso-8859-1'
        $Env{"Baselink"} --> the baselink --> index.pl?SessionID=...
        $Env{"UserFirstname"} --> e. g. Dirk
        $Env{"UserLastname"} --> e. g. Hohndel
        $Env{"UserLogin"} --> e. g. mgg@x11.org
        $Env{"UserIsGroup[users]"} = Yes --> user groups (useful for own links)
        $Env{"UserIsGroup[admin]"} = Yes
        $Env{"Action"} --> the current action
        $Env{"Subaction"} --> the current subaction

System calls

To get the output of a system command use:

    # execute system call
    <dtl system-call $Data{"uptime"} = "uptime">

    # print
    $Data{"uptime"}

or

    # execute system call
    <dtl system-call $Data{"procinfo"} = "procinfo | head -n1 ">

    # print
    $Data{"procinfo"}

Examples

    # set variable
    <dtl set $Data{"Test1"} = "English">

    # print variable
    Echo: $Data{"Test1"}

    # condition
    <dtl if ($Text{"Lock"} ne "Lock") { $Data{"Test2"} = "Not English!"; }>

    # print result
    Result: $Data{"Test1"}

or

    # translation test
    Lock: $Text{"Lock"}

    # config options
    Sendmail: $Config{"Sendmail"}

Prev | Home | Next
Language translations |  | Examples of dtl files