#IF
XSSI conditional server side include.
Note: the following #SET variables are equal to:
Some explicit comparisons:
| Contents of this file (/sre2k/srehttp2/demos/iftest.sht) |
|---|
<!DOCTYPE HTML PUBLIC "-//W3 Organization//DTD W3 HTML 2.0//EN">
<html>
<head>
<title>SREhttp/2: Test of #IF</title>
</head>
<body>
<h1>Test of #IF</h1>
This document contains a simple demonstration of the <code>#IF</code>
<em>XSSI</em> conditional server side include.
<p>
<!-- Begin set statements ----------- -->
<!-- The following SET variables control the processing of the #IF statements,
hence what is displayed -->
<!-- MODE can be either SAMPLE or HELP or anything else -->
<!-- #set var="MODE" value="SAMPLE" -->
<!-- SAMPLE_TYPE can be either 1,2 ,or 3 -->
<!-- #set var="SAMPLE_TYPE" value="1" -->
<!-- SUB_MODE1 can be A or anything else -->
<!-- #set var="SUB_MODE1" value="A" -->
<!-- SUB_MODE2 can be B or anything else -->
<!-- #set var="SUB_MODE2" value="C" -->
<!-- If SHOW_FILE=1, then display this file as PRE -->
<!-- #set var="SHOW_FILE" value="1" -->
<!-- END of set statements ----------- -->
<b>Note:</b> the following #SET variables are equal to:<ul>
<li><TT>MODE = </tt> <!-- #echo var="MODE" -->
<li><TT>SAMPLE_TYPE = </tt> <!-- #echo var="SAMPLE_TYPE" -->
<li><TT>SUB_MODE1 = </tt> <!-- #echo var="SUB_MODE1" -->
<li><TT>SUB_MODE2 = </tt> <!-- #echo var="SUB_MODE2" -->
<li><TT>SHOW_FILE = </tt> <!-- #echo var="SHOW_FILE" -->
</ul>
<hr width="30%"><center>Begin the test ....</center> <hr width="30%">
<!-- #IF expr="(\"$MODE\"=\"HELP\")" -->
Help Mode (no other options):
<!-- #elif expr="$MODE=SAMPLE" -->
Samples Mode (SAMPLE_TYPE and SUB_MODE1): <br>
<!-- #if expr="$SAMPLE_TYPE=1" -->
Sample_type=1 (SUB_MODE1 ignored)
<!-- #elif expr="$SAMPLE_TYPE=2" -->
Sample_type= 2 ,
<!-- #if expr="$SUB_MODE1=A" -->
Sub_MODE1= A <p>
<!-- #else -->
SUB_Mode1 <> A <p>
<!-- #endif -->
<!-- #elif expr="$SAMPLE_TYPE=3" -->
Sample_type= 3 (SUB_MODE1 ignored) <br>
<!-- #else -->
Sample_type = something else (SUB_MODE1 ignored) <br>
<!-- #endif -->
<!-- #else -->
Default mode (SUB_MODE1 and SUB_MODE2):<br>
<!-- #if expr="$SUB_MODE1=A" -->
sub_Mode1=A ,
<!-- #else -->
sub_Mode1 <> A ,
<!-- #endif -->
<!-- #if expr="$SUB_MODE2=B" -->
sub_mode2 = B
<!-- #endif -->
<br>
<!-- #endif -->
<hr width="30%"><center>End of test ....</centeR> <hr width="30%">
<p>
Some explicit comparisons:
<ul>
<li>$SUB_MODE2 != $SUB_MODE1 :
<!-- #if expr="$SUB_MODE2 != $SUB_MODE1" -->
<tt>true</tt>
<!-- #else -->
</tt>false </tt>
<!-- #endif -->
<li> (SUB_MODE1="A") && (SUB_MODE2 != "B") :
<!-- #if expr=" ($SUB_MODE1=\"A\") && ($SUB_MODE2 !=\"B\")" -->
<tt>true</tt>
<!-- #else -->
<tt>false</tt>
<!-- #endif -->
</ul>
<br>
<!-- #If expr="$SHOW_FILE==1" -->
<!-- Interpret code
goop=sre_read_file(usedfile,1,2) ;
if goop<>'' then do ;
goop=sre_html_encode(goop) ;
return '<table border=1><tr><th align="left">Contents of this file ('||selector||')</th>'||'<tr><td><pre>'||goop||'</pre></td></table>'||'0da0'x;
end;
-->
<!-- #ENDIF -->
</body>
</html>
|