Set variable:-
|
Get variable:-
|
Template Scope:
Variable access is restricted within the template only. Accessible within the template itself.
1 2 3 4 5 6 7 8 9 10 11 |
[templates.add main] //** Set variable in Template **// [template.set variable_text="I am template scope value" /] Variable Text in Main: [template.get variable_text /] [templates.run example /] [/templates.add] [templates.add example] //** NOT accessible here **// Variable Text in Example: [template.get variable_text /] [/templates.add] |
Module Scope:
Access the variable in any template of that module. Variable is accessible in all the templates of that module.
1 2 3 4 5 6 7 8 9 10 11 |
[templates.add main] //** Set variable in Module **// [module.set variable_text="I am template scope value" /] Variable Text in Main: [module.get variable_text /] [templates.run example /] [/templates.add] [templates.add example] //** Accessible here **// Variable Text in Example: [module.get variable_text /] [/templates.add] |
Environment Scope:
Initialize the variable and access anywhere wherever you need it. Within template or any other module or set it in the module and access in another service. Everywhere it is accessible.
1 2 3 4 5 6 7 8 9 10 11 |
[templates.add main] //** Set variable in Environment **// [env.set variable_text="I am template scope value" /] Variable Text in Main: [env.get variable_text /] [templates.run example /] [/templates.add] [templates.add example] //** Accessible here and in any other module or service... **// Variable Text in Example: [env.get variable_text /] [/templates.add] |
Access a value from one module to any other, use the env scope and access the value.
1 |
Variable Text in Example: [env.get variable_text /] |