<w:var> enhancements

WebvantaScript's variable tag (e.g. <w:var name="my_variable">) allows you to capture a value that can subsequently be used in other WebvantaScript tag attributes. Until now, the content stored in the variable alway came from the value attribute or the text between the opening and closing <w:var> tags.

Two new enhancements give you access to additional content:

  1. Using the param="key name" attribute will attempt to read a query parameter from the current page's URL. If the param does not exist, the variable will be assigned the value between its opening and closing tags. If that is also empty, the variable will use the content from the "value" attribute as a default value.
  2. When using the value of a variable (with the {{my_variable}} syntax), if the value is empty from any of the means described in #1, the system will try to use the name of the variable to look up a value in your Global Settings. You can use this for easy access to Global Settings in WebvantaScript conditional attributes, for instance, or as a way of specifying a global default value.
Have more questions? Submit a request


  • 0

    Christopher - could you provide a couple of examples, please? 

  • 0
    Christopher Haupt

    If you have a URL with a parameter:


    You can capture the person parameter from WebvantaScript with

    <w:var name="the_person" param="person">No one</w:var>

    This technique is most useful when trying to pass some short-term information between pages, and the recipient page using the param is a non-cached (Ajax) page. You could, for instance pass an ID of an item, and then consume that ID to create an item context:


    Then on the my_ajax_page have some wscript like:

    <w:kb:item id="{{item_id}}" >


    If perhaps you always wanted some default value for that item, you could create a system config with the same name "item_id" and set that to value that would then be used as a "default" if they parameter was NOT passed in the URL.

Please sign in to leave a comment.
Powered by Zendesk