next up previous contents
Next: MICelse Up: MICif Previous: Syntax   Contents

Description

The MICif is a special tag which allows for parts of a page to be conditionally constructed or proccessed4.4. This tag helps to maintain consistency in HTML look and avoids always having to use the MICPerl tag.

The MICif tag should be used whenever there are sections of the page or control code which should only be conditionally processed and/or constructed. As mentioned earlier, this tag could be subsumed into MICPerl (in certain cases), but that would break the HTML look and simplicity, which is the goal of MIC. Compare:

<MICPerl>
if ($sufficient_funds){
</MICPerl>

     <h2>You have enough money</h2>
<MICPerl>
}
else{
</MICPerl>
      <h2>Sorry, insufficient funds.</h2>
<MICPerl>
}

</MICPerl>

to:

<MICif test="$sufficient_funds">

<h2>You have enough money</h2>

</MICif>

<MICelse>

<h2>Sorry, insufficient funds.</h2>

</MICelse>

The MIC code (which may include a MICPerl) contained within the opening and closing MICif tags constitutes a lexical block of code. This is true of all the MIC native logic tags.

MICif tags are only potent at runtime, however. A MICfieldspace within a MICif, for instance, is legal, but will actually have no effect. The MICfieldspace will be read at compile time and the fieldspace will end up being defined.