For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

set

Sets a scratchpad variable to the value specified in the tag body, and saves the scratchpad variable into the user's session.  This tag will not interpolate its body text by default.

Summary

  • [set name] String to save [/set]

Parameter Description Default
name The name of the scratchpad variable you would like to set. None
interpolate

Parse Interchange tags, included in the body text, before this container tag executes.

No

Examples

Tag expansion example

[set foo] Hello world [/set]

The above sets up for the following example of a subsequent retrieval:

[scratch foo]
Hello World

Since the tag does not interpolate by default keep in mind this next example, which would store then produce the following:

[value name="bar" set="Joe" hide=1]
[tmpn foo] Good Morning, [value bar]! [/tmpn]
[scratch foo]
Good Morning, [value bar]!

If the [seti] tag had been used then the result would have been: 

Good morning, Joe!

Perl example

$Tag->set({
    name => $name,
    body => $value,
});

or similarly with positional parameters:

$Tag->set($name, $value);

The following is more efficient than calling $Tag->set(), and yields the same result:

$Scratch->{$name} = $value;

Description

Sets a scratchpad variable to the value specified in the tag body.

This tag does not interpolate automatically.  Interpolation can be turned on by either passing the interpolate=1 parameter, or by simply using the [seti] tag instead.

Most of the mv_* variables that are used for search and order conditionals are in another namespace.  They can be set by means of hidden fields in a form.

For instance, you can set an order profile with the following:

<input="hidden" name="mv_order_profile" value="checkout">

[set checkout]
    name=required
    address=required
[/set]

A search profile could be set with the following:

<input="hidden" name="mv_profile" value="substring_case">

[set substring_case]
    mv_substring_match=yes
    mv_case=yes
[/set]

Any of these profile values can be set in the OrderProfile files instead, of course.

The "set scratchpad variable" tags are all very similar.  The following table will help you select the one that's correct for your requirements:

Tag name Temporary Interpolates
set No No
seti No Yes
tmpn Yes No
tmp Yes Yes

Parameters

name

The name of the scratchpad variable whose value you want to set.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Wednesday 6 December 2006 at 5:04 PM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us