
########
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:


.. code-block:: perl

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


Using a template string:


.. code-block:: perl

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


Additional parameters:


.. code-block:: perl

     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.


.. code-block:: perl

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



AddJSOnDocumentCompleteIfNotExists()
====================================


adds JavaScript only if it haven't been added yet.


.. code-block:: perl

     my $Success = $LayoutObject->AddJSOnDocumentCompleteIfNotExists(
         Key  => 'identifier_key_of_your_js',
         Code => $JSBlock,
     );


Returns:


.. code-block:: perl

     my $Success = 1;



AddJSData()
===========


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


.. code-block:: perl

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





