This function can be used to encode the result of an ISML expression. The value of an ISML expression is returned by encodeValue()
as a properly encoded string. Non string values are converted to a string before encoding is performed. The convertion is the same like calling the function getValue()
. For details about the possible encodings see Cookbook - Encoding.
encodeValue( <value> ) encodeValue( <value>, <encoding> )
The first example shows how to properly encode user entered values if the actual message is printed with encoding="off"
<istext key="welcomeMessage" parameter0="#encodeValue(Profile:FirstName)#" parameter1="#encodeValue(Profile:LastName)#" encoding="off"/>
The next example shows how to specify an encoding (see Cookbook - Encoding for more variants:
#encodeValue(Profile:FirstName, 'json')
value
value = ISML Expression
Specify the ISML expression to be encoded. Usually, this will be just a template variable. If the expression result is not of type string then this value will be converted before encoding takes place. Conversion is done in the same way as getValue(value)
.
encoding
encoding = ISML Expression
Optional parameter.
If the parameter is not set or null the encoding matching the current template type is used. Otherwise the encoding must be string with encoding identifiers, like html
, javascript
. For more details on how to use encoding types supported by Intershop or add a custom encoding type see: Cookbook - Encoding.