Document Tree
Document Properties
Kbid
247L37
Last Modified
04-Feb-2020
Added to KB
20-Jun-2013
Public Access
Everyone
Status
Online
Doc Type
References
Product
  • ICM 7.10
  • ICM 11
  • ICM 12
ISML Tag - ISIF

Name

ISIF

Short Description

creates conditional ISML code

Table of Contents

Product Version

6.5

Product To Version

 

StatusNew Labels

Introduction

The <ISIF> tag group allows you to create conditional ISML code. <ISIF>, and its supporting tags, <ISELSEIF> and <ISELSE> , will likely be the tags you use most in your templates. These are also called business flow functions because they control the business logic's flow.

Every <ISIF> tag must have a matching </ISIF> tag. <ISIF> uses operators to compare values. For more information about operators, see Reference - ISML Operators. To perform more complex comparisons, you can combine conditions within parentheses using logical operators. You can compare any values accessible through variables, as well as numerical and string constants.

The <ISELSE> and <ISELSEIF> tags are optional. You may use as many <ISELSEIF> tags as needed in an <ISIF> statement, but you can only use one <ISELSE>, which must always be the last comparison performed.

Syntax

<isif condition = "{ISML expression}">
... some HTML and ISML code ...
[
  <iselseif condition = "{ISML expression}">
... some HTML and ISML code ...
]*
[
  <iselse>
... some HTML and ISML code ...
]
</isif>

Example

The example shows some possible conditional entries in a template (with and without using operators):

<isif condition="#hasLoopElements(Basket:ProductLineItems)#">
<isif condition="#isDefined(Error_PasswordConfirmation)#">
<isif condition="#Error_PasswordConfirmation EQ 'MandatoryValueNotAvailable'#">
<isif condition="#(isdefined(ERROR_FormValues)) OR (isdefined(ERROR_User))#">
<isif condition="#(isdefined(ERROR_FormValues) AND isdefined(ConfirmMail)) OR (not(isdefined(ERROR_FormValues)))#">

This example shows how to alternate the colors of the rows in a table. The current color is stored in the user-defined variable, color.

<ISSET name="color" value="#'#00FFFF'#">
  <table>
    <ISLOOP iterator="basket:product">
    <tr>
      <td bgcolor="#color#">
        <ISPRINT value = "#product:name#">
      </td>
    </tr>
    <ISIF condition="#color EQ '#00FFFF'#">
      <ISSET name="color" value="#'#00CCFF'#">
      <ISELSEIF condition="#color EQ '#00CCFF'#">
      <ISSET name="color" value="#'#0099FF'#">
      <ISELSE>
      <ISSET name="color" value="#'#00FFFF'#">
    </ISIF>
  </ISLOOP>
</table>

The result of a conditional expression must be a Boolean value:

<ISIF condition ="#Products:Price==0#"> Special free gift.
  <ISELSEIF condition ="#Products:Price<100#">
  Special deal.
  <ISELSE>
  Today’s low price.
</ISIF>

Attributes

condition

This attribute is required.

condition = Boolean ISML expression

For <ISIF> and <ISELSEIF>, specify an expression that must evaluate to a Boolean value. If the expression evaluates to true, the enclosed code is executed, otherwise it is not. <ISELSE> has no attributes.

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.
The Intershop Knowledge Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.