Variables and Arrays
Variables:
You can create a variable and put a value into it using the following function:
example:
(The outputtotemplate boolean will determine if the value is written out to the template as well as stored in memory, or just stored in memory.)
You can read a variable and use it in another function, or simply render it into the template using the following function:
example: simply rendering out:
example: using within another function:
Arrays:
You can append items to an array using the following function: (this is useful within a loop when you need to sum a list of numbers at the end)
example:
(The outputtotemplate boolean will determine if the value is written out to the template as well as appended to the array, or just appended to the array.)
You would generally not render an array straight into the template - they would typically be used by another function or block statement that takes arrays, using the following function:
example: passing into another function:
example: adding a new column to an in memory csv data store:
Last updated