ISML Tag - ISSET

Name

ISSET

Short Description

can be used to define and set a user-defined variable

Table of Contents

Product Version

6.5

Product To Version

 

Statusfinal

1 Introduction

<ISSET> can be used to define and set a user-defined variable.

The first occurrence of <ISSET> in a template declares and sets the variable, there is no other special tag needed for declaration. In case the variable already exists, <ISSET> resets it to the specified value.

The special attribute scope is available to determine the scope of the user-defined variable. The scope is required and can be either request(default) or session.

  • Request scope
    The scope request means that the variable is accessible within the current request only. The value of the variable is stored in the pipeline dictionary. Using request scope is useful in case you want to work with a temporary variable which does not need to be persisted to the database. This prevents the session object from being polluted with temporary data and renders additional session synchronization with the database unnecessary.
  • Session scope
    The scope session means that the variable is accessible to all templates during a particular storefront session. The lifetime of a session variable ends with a session. A session variable can be used in expressions and is identified by its simple name. Values can now be of any type, not just Double and String.

    Note

    Non-serializable objects stored at session scope are not be written to the database when the session is made persistent.

2 Syntax

<isset
  value = "( {String} | {ISML expression} )"
  name = "{simple name}"
  scope = "( request | session )"
>

3 Example

The following example shows how <ISSET> is used to define and initialize a variable named color. The value of color is the string #A0CC99.

<isset scope="request" name="color" value="#'#A0CC99'#">

In the next example, if a variable was already defined by a former <ISSET> tag (first line), a second <ISSET> resets the value of the variable (second line):

<isset scope="request" name="counter" value="#0#" >
<isset scope="request" name="color" value="#counter + 1#">

Finally, the examples below illustrate the usage of the scope attribute:

<!-- the value goes to the session -->
<isset scope="session" name="foo" value="bar">
<!-- the value goes to the pipeline dictionary -->
<isset scope="request" name="foo" value="bar">

4 Attributes

4.1 scope

This attribute is required.
scope = request | session
The default value is request. Specifies the scope of a user-defined variable. In case of request scope, the value is stored to the pipeline dictionary. In case of session scope, the value is stored to the session.

4.2 name

This attribute is required.
name = simple name
Specifies the name of a user-defined variable. Mind the following rules for naming user-defined variables:

  • Identifiers must start with a letter (a-z, A-Z).
  • Any following character can be a letter, number, or underscore.
  • User-defined variables are case-sensitive.

4.3 value

This attribute is required.
value = ISML Expression
Specifies a value to be stored in the variable. Value can be of any type.

Note

Non-serializable objects stored at session scope are not be written to the database when the session is made persistent.

Reference - ISML Tags

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets