snippet-1427238028


Global vs Local Variables

Each Miva Merchant Entity has a scope. It is either a local variable which is accessed using `l.settings:` or a global variable accessed using `g.` [Documentation](http://www.miva.com/template-language/miva_template_language/global_&_local_variables.html) [Tutorial](http://www.miva.com/videos/web_developers/entities)
Created: 1427238028
View "Global vs Local Variables"
<h2>Global Variables</h2> <mvt:assign name="g.foo" value=" 'bar' " /> g.foo is, "&mvt:global:foo;"<br/> <mvt:if expr="g.foo EQ 'bar'"> g.foo EQ 'bar' is true!<br/> </mvt:if> <h2>Local Variables</h2> <h4>With l.settings</h4> <mvt:assign name="l.settings:foo" value=" 'bar' " /> l.settings:foo is, "&mvt:foo;"<br/> <mvt:if expr="l.settings:foo EQ 'bar'"> l.settings:foo EQ 'bar' is true!<br/> </mvt:if> <h4>Without l.settings</h4> <mvt:assign name="l.foo" value=" 'bar' " /> l.foo is, "&mvt:foo;"<br/> <mvt:if expr="l.foo EQ 'bar'"> l.foo EQ 'bar' is true!<br/> </mvt:if>