Skip to content

Working with Variables#


Variables are one of the core components of the Miva Template Language. They allow you to store, manage, and manipulate data dynamically, providing the flexibility needed to create customized and interactive e-commerce experiences.

In this section, we’ll explore how to define, scope, and use variables effectively, ensuring your templates are both powerful and efficient.


What You’ll Learn#

By the end of this section, you’ll have a strong understanding of:

  1. Variable Scopes: The difference between global and local variables and when to use each.
  2. Declaring and Assigning Variables: How to create variables and assign values to them using the <mvt:assign> tag.
  3. Manipulating Variables: Practical examples of modifying and using variables to control template behavior.

Topics Covered#

Global and Local Variables#

Understand the scope and lifecycle of variables in the Miva Template Language. Learn how to use g. (global) and l. (local) prefixes to manage data effectively.

Learn More: Global and Local Variables →


Assigning Variables#

Use the <mvt:assign> tag to declare variables and assign values. This topic covers syntax, best practices, and real-world examples.

Learn More: Assigning Variables →


Why This Section is Important#

Variables are the backbone of any dynamic application, and Miva templates are no exception. Properly understanding and managing variables is critical for building robust and maintainable templates. By mastering these skills, you’ll be able to create templates that are both efficient and scalable.


Next Steps#

Ready to get started? Begin with Global and Local Variables to understand how to scope your data, or jump to Assigning Variables for hands-on examples.

Let’s dive into the dynamic world of Miva variables!