dw.template
Class ISML
Object
dw.template.ISML
This class provides support for rendering ISML templates. For more details about the ISML syntax, refer to the Commerce Cloud Digital developer documentation. Templates are stored as *.isml files. They are located in a locale-specific folder under the '/cartridge/templates' folder, with '/cartridge/template/default' being the default locale. The template name arguments of the various render methods represent the template path (without file ending) within this folder structure.

Example for rendering a template with arguments from JavaScript code:

 let isml = require('dw/template/ISML');
 isml.renderTemplate('helloworld', {
     Message: 'Hello, World!'
 });
 
Example code for accessing the template arguments in the 'helloworld.isml' template from the above code snippet:
 The message is: <isprint value="${pdict.Message}" />
 
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
static renderTemplate(template : String) : void
Renders an ISML template and writes the output to the current response.
static renderTemplate(template : String, templateArgs : Object) : void
Renders an ISML template and writes the output to the current response.
static renderTemplate(template : String) : void
Renders an ISML template and writes the output to the current response.
static renderTemplate(template : String, templateArgs : Object) : void
Renders an ISML template and writes the output to the current response.
Method Detail
renderTemplate
static renderTemplate(template : String) : void
Renders an ISML template and writes the output to the current response. The template may contain ISML tags which control the character encoding, content type, caching behavior and so on of the response (see ISML documentation).
API Versioned:
No longer available as of version 17.7. Puts template arguments into the global pipeline dictionary.
Parameters:
template - the template path

renderTemplate
static renderTemplate(template : String, templateArgs : Object) : void
Renders an ISML template and writes the output to the current response. The template may contain ISML tags which control the character encoding, content type, caching behavior and so on of the response (see ISML documentation). This method takes an additional JavaScript object as argument. Its properties are accessible for script expressions in the template under the "pdict.*" variable.
API Versioned:
No longer available as of version 17.7. Puts template arguments into the global pipeline dictionary.
Parameters:
template - the template path
templateArgs - the template arguments object

renderTemplate
static renderTemplate(template : String) : void
Renders an ISML template and writes the output to the current response. The template may contain ISML tags which control the character encoding, content type, caching behavior and so on of the response (see ISML documentation).
API Versioned:
From version 17.7. Keeps template arguments in a local pipeline dictionary scope. This avoids side-effects on other templates.
Parameters:
template - the template path

renderTemplate
static renderTemplate(template : String, templateArgs : Object) : void
Renders an ISML template and writes the output to the current response. The template may contain ISML tags which control the character encoding, content type, caching behavior and so on of the response (see ISML documentation). This method takes an additional JavaScript object as argument. Its properties are accessible for script expressions in the template under the "pdict.*" variable.
API Versioned:
From version 17.7. Keeps template arguments in a local pipeline dictionary scope. This avoids side-effects on other templates.
Parameters:
template - the template path
templateArgs - the template arguments object