Attributes . . Usage . . Related Topics . . Tag Index . . Home


<?MIBLOCK><?/MIBLOCK>

The MIBLOCK tag enables you to delimit a logical block of HTML to be executed on the basis of a variety of conditions.

Attributes

COND A variable or variable expression that evaluates to FALSE (0) or TRUE (nonzero). Conditions are evaluated from left to right. The tag is enabled only if this condition evaluates to TRUE.
ERR Specifies how an error should be processed. Because multiple errors can occur on an AppPage, use the ERR attribute to link the error processing to a particular MIERROR tag. The ERR attribute for the MIBLOCK tag is only invoked if an error occurs when evaluating the condition specified in the COND attribute. For more information on the ERR attribute, see the MIERROR tag.

Usage

The MIBLOCK tag is the only tag in which you can nest other tags. You can also nest MIBLOCK tags within MIBLOCK tags. Variables are interpreted only within MISQL, MIVAR, and MIERROR tags and within the COND attribute of the MIBLOCK tag.

Using the COND Attribute

All tags except MIEVENT can have a COND attribute. The COND attribute specifies a condition that is evaluated before the tag is processed. If the condition is true, the tag is processed.

The following cond_display AppPage uses the COND attribute within an MIBLOCK tag to conditionally display text depending on the value of a variable:

  <HTML>
  <HEAD><TITLE>Conditional Display</TITLE></HEAD>
  <BODY>
  <?MIVAR COND=$(NXST,$VAR1) NAME=$VAR1>0<?/MIVAR>
    This is always displayed.<BR>
  <?MIBLOCK COND=$VAR1>
    This is conditionally displayed if VAR1 is nonzero.<BR>
    <B>The value of VAR1 is: <?MIVAR>$VAR1<?/MIVAR></B><BR>
  <?/MIBLOCK>
  This is always displayed.
  </BODY>
  </HTML>

If the condition in the MIBLOCK tag evaluates to TRUE--that is, if the VAR1 variable has been assigned a value other than 0 in the URL that calls it or in an HTML form--the value of the variable is displayed. For example, if the AppPage is called with the URL:

http://myhost/ifmx-bin/wcdrvr.exe/wcdaemon.exe?MIval=cond_display&VAR1=1

the preceding AppPage returns the following output to the client:

  <HTML>
  <HEAD><TITLE>Conditional Display</TITLE></HEAD>
  <BODY>
  This is always displayed.<BR>
  This is conditionally displayed if VAR1 is nonzero.<BR>
  <B>The value of VAR1 is: 1</B><BR>
  This is always displayed.
  </BODY>
  </HTML>

If the VAR1 variable is unassigned, the preceding AppPage returns the following output to the client:

  <HTML>
  <HEAD><TITLE>Conditional Display</TITLE></HEAD>
  <BODY>
  This is always displayed.<BR>
  This is always displayed.
  </BODY>
  </HTML>

Related Topics

For information about how to escape special characters (", { , }, and $) so that they are interpreted literally, see Special Characters in AppPage Tags.


Top of Page . . Attributes . . Usage . . Tag Index . . Home