Christopher Haupt
posted this on June 29, 2011, 17:43
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:
Comments
Christopher - could you provide a couple of examples, please?
If you have a URL with a parameter:
http://www.webvanta.com/team?person=chris
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:
http://www.example.com/my_ajax_page?item_id=12345
Then on the my_ajax_page have some wscript like:
<w:kb:item id="{{item_id}}" >
</w:kb:item>
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.