OTRS CVS - Manual
Prev |  | Next

# Chapter 17. 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 site the way you want to! You may even create completely 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"} only exists in the current dtl file, whereas $Env{"xyz"} exists throughout all dtl files. New: $Config{"xyz"} is not only just read anymore, but exists throughout the whole program! (2002-05-22 / 0.5 BETA5)

Print a variable

To print a variable on the screen, simply use:

    $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 text will be shown as given.

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

Include a other dtl file - $Include{}

To include the css.dtl file:

    $Include{"css"}

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
Customizing Translations |  | Examples of dtl files