Client Side Template
{*if <undefined<var 1,var 2>>}...{*endif}
Description
Lets you append strings in the template when variables are undefined.
This command simplifies the following, much more cumbersome, template:
{*if typeof variableName1 == 'undefined' || typeof variableName2 == 'undefined'} ... {*endif}
For example, take this JSON data.
{ employees: [ {firstname: 'Fred', lastname: 'Smith', state: 'MA'}, {firstname: 'Laura', lastname: 'Linneker', state: 'CA'}, {firstname: 'Junior', lastname: 'Programmer', state: 'MA'}, {firstname: 'Bill', lastname: 'Lindsey', state: 'NY'} ] }
Using this template an 'if' command is fired when the 'state' field equals MA. When this happens if the 'nothere' and 'nothereeither' are undefined, because they don't exist in the data, then a 'Theses Variables are undefined' statement is shown.
{employees} Employee name:{firstname} <div> {*if state=='MA'} Employee from MA {*if <undefined<nothere,nothereeither>>}These Variables are undefined{*endif} {*endif} </div><br/> {/employees}
Result:
Employee name:Fred Employee from MA These Variables are undefined Employee name:Laura Employee name:Junior Employee from MA These Variables are undefined Employee name:Bill