Kernel::Output::HTML::Layout::Template

NAME

Kernel::Output::HTML::Layout::Template – template rendering engine based on Template::Toolkit

PUBLIC INTERFACE

Output()

generates HTML output based on a template file.

Using a template file:

    my $HTML = $LayoutObject->Output(
        TemplateFile => 'AdminLog.tt',
        Data         => \%Param,
    );

Using a template string:

    my $HTML = $LayoutObject->Output(
        Template => '<b>[% Data.SomeKey | html %]</b>',
        Data     => \%Param,
    );

Additional parameters:

    AJAX - AJAX-specific adjustements: this causes [% WRAPPER JSOnDocumentComplete %] blocks NOT
        to be replaced. This is important to be able to generate snippets which can be cached.
        Also, JS data added with AddJSData() calls is appended to the output here.

    my $HTML = $LayoutObject->Output(
        TemplateFile   => 'AdminLog.tt',
        Data           => \%Param,
        AJAX           => 1,
    );

    KeepScriptTags - DEPRECATED, please use the parameter "AJAX" instead

AddJSOnDocumentComplete()

dynamically add JavaScript code that should be executed in Core.App.Ready(). Call this for any dynamically generated code that is not in a template.

    $LayoutObject->AddJSOnDocumentComplete(
        Code => $MyCode,
    );

AddJSData()

dynamically add JavaScript data that should be handed over to JavaScript via Core.Config.

    $LayoutObject->AddJSData(
        Key   => 'Key1',  # the key to store this data
        Value => { ... }  # simple or complex data
    );
Scroll to Top