VAR tags

Advanced Template Techniques- Last updated Nov 2, 2016

The variable tag allows you to use information from your pages and display that information on your product pages or in your product template. VAR tags can also be used in all templates across your store. Normally you cannot use page tags in a product template, but by using a VAR tag you can call the needed information. For example, if you have the defining tag below listed on your page template:

    [-- VAR.text3 PAGE.Text3 --]

You can retrieve the information from the set value (in this case, Page.Text3) on other templates by using the retrieving VAR tag:

    [-- VAR.text3 --]

Defining tags should be placed at the top of your template. Retrieving tags can be placed wherever they are needed.

You can store almost any value in a VAR tag. You can even set the value in the template, for example:

    [-- VAR.thanks "Thank you for visiting our website!" --]

Now, if you enter in [-- VAR.thanks --] elsewhere in any template or on your page, it will replace the code with the value entered: Thank you for visiting our website!

If the value you enter is numeric, you can increase or decrease the value by 1 by using the INC and DEC parameters, for example:

    [-- VAR.count 12 --]
    [-- VAR.count INC --]

The INC tag increased the numeric value, so now the count tag has a value of 13.

Once a VAR tag is defined, it can be used in other templates and the LOOP and CALL tags. You can use tags like [-- LOOP PRODUCTS VAR.numcolumns --] [-- CALL program.cgi VAR.xxxx --] once you've defined the respective VAR tags.

Related Articles

VAR Tag Help