OTRS API Reference JavaScript

Namespace: Core.Template

Core. Template

This namespace contains initialization functionalities.
Author:
  • OTRS AG
Source:

Methods

(static) Init()

Init the engine environment.
Source:

(static) Load(TemplateData)

Load all template files for later use.
Parameters:
Name Type Description
TemplateData Object contains the objectified template data as provided by the loader
Source:

(static) Render(TemplateName, Data) → {String}

Render a template with the given data.
Parameters:
Name Type Description
TemplateName String The name of the templated which should be used for rendering as of Core.Template.LoadTemplates()
Data Object the data which should be used for rendering (optional)
Source:
Returns:
- the rendering result
Type
String
Example
Core.Template.Render('MetaFloater', {
      'Variable' : 'String',
      'Another'  : 'Another String'
  });

For more examples and possibilities, see the Nunjucks documentation.

(static) RenderString(TemplateString, Data) → {String}

Render a string with the given data.
Parameters:
Name Type Description
TemplateString String The string which should be used for rendering as of Core.Template.LoadTemplates()
Data Object the data which should be used for rendering
Source:
Returns:
- the rendering result
Type
String