home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
srev13h.zip
/
xssi.sht
< prev
next >
Wrap
Text File
|
1999-06-01
|
6KB
|
181 lines
<!DOCTYPE HTML PUBLIC "-//W3 Organization//DTD W3 HTML 2.0//EN">
<html>
<head>
<title>The XSSI extensions</title>
</head>
<body>
<P>
<h2 align="center">The XSSI extensions to SRE-http </h2>
SRE-http supports a subset of the <tt>Apache XSSI</tt> extensions
to the NCSA HTTPD server side includes</em>:
<dl>
<!-- ! #SET ******** -->
<dt> <!-- #set var="varname" value="some value" -->
<dd>
<tt>#set</tt> is used to define variables for use in other
HTTPD-style server side includes.
<ul>
<li><tt>var</tt>: The name of the variable to set.
<li><tt>value</tt>: value to give a variable.
</ul>
For example:<br>
<CODE><!--#set var="category" value="help" --></CODE><br>
<p>
<!-- ! #IF ********* -->
<dt>
<!--#if expr="<I>test_condition</I>" -->
<!--#elif expr="<I>test_condition</I>" -->
<!--#else -->
<!--#endif -->
<dd> The <B><CODE>if</CODE></B> element works like an
if statement in a programming language. The test condition
is evaluated and if the result is true, then the text until
the next <B><CODE>elif</CODE></B>, <B><CODE>else</CODE></B>.
or <B><CODE>endif</CODE></B> element is included in the
output stream.
<P> The <B><CODE>elif</CODE></B> or <B><CODE>else</CODE></B>
statements are used if the original test_condition is false.
These elements are optional. Note that the first
<em>true</em> statement is used, and <code>else</code>
is <b>always</b> true (it does NOT take an <code>expr</code>).
<P> The <B><CODE>endif</CODE></B> element ends the
<B><CODE>if</CODE></B> element and <b>is required</b>.
<P> <I>test_condition </I> can be any valid REXX statement.
In addition, the following Apache (C) style comparions
are also supported:<blockquote>
<DL>
<DT><tt><I>string</I><DD>true if <I>string</I></tt> is not empty
<DT><tt><I>string1</I> = <I>string2</I></tt><BR>
<DD>Compare string1 with string 2.
<DT><tt><I>string1</I> != <I>string2</I></tt><BR>
<DD>Compare string1 with string 2, TRUE if not equal.
<DT><tt>( <I>test_condition </I> )</tt>
<DD>true if <I>test_condition</I> is true
<DT><tt>! <I>test_condition </I></tt>
<DD>true if <I>test_condition </I> is false
<DT><tt><I>test_condition1 </I> && <I>test_condition2 </I></tt>
<DD>true if both <I>test_condition1 </I> and
<I>test_condition2</I> are true
<DT><tt><I>test_condition1 </I> || <I>test_condition2 </I> </tt>
<DD>true if either <I>test_condition1</I> or
<I>test_condition2</I> is true
</DL>
<P> "<I>=</I>" binds more tightly than "<I>&&</I>" and
"<I>||</I>".
"<I>!</I>" binds most tightly. Thus, the following are equivalent:
<PRE>
<!--#if expr="$a = test1 && $b = test2" -->
<!--#if expr="($a = test1) && ($b = test2)" -->
</PRE>
</dl>
</blockquote>
Would you like to <a href="iftest.sht">see a demo of #IF</a>
<hr width="40%">
<H2>Using #set variables</H2>
<P> #set variables are used as <em>textual substitutions</em>
within quoted. This substituion is performed
where they may reasonably occur as an argument to an SSI directive.
This includes the
<SAMP>config</SAMP>,
<SAMP>exec</SAMP>,
<SAMP>flastmod</SAMP>,
<SAMP>fsize</SAMP>,
<SAMP>include</SAMP>, and
<SAMP>set</SAMP>
directives, as well as the arguments to conditional operators.
<p><b>Notes:</b><menu>
<li>In order to insert a literal dollar sign into an NCSA-style
SSI directive, you must use the backslash (\) character
as a quote:
<PRE>
<!--#if expr="$a = \$test" -->
</PRE>
<li> If a variable reference needs to be substituted in the middle of a
character sequence that might otherwise be considered a valid
identifier in its own right, it can be disambiguated by enclosing
the reference in braces. For example:
<PRE>
<!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" -->
</PRE>
<P> This will result in the <SAMP>Zed</SAMP> variable being set to
"<SAMP>X_Y</SAMP>" if <SAMP>REMOTE_HOST</SAMP> is
"<SAMP>X</SAMP>" and <SAMP>REQUEST_METHOD</SAMP> is
"<SAMP>Y</SAMP>".
<br><br>
<li> When using a #set variable in an #ECHO element, you should
<b>not</b> include the $ preface. For example, assuming you've
defined <tt> <!-- #set var="foo" value="hello world" --></tt>,
then:
<menu>
<li><B>Correct</b>: <!-- #echo var="foo" -->
<li><B>InCorrect</b>: <!-- #echo var="$foo" -->
</menu>
<li> You can reference regular <em>CGI</em> variables
using the $ syntax (as noted in the following example).
<li>If you define a #set variable that uses a <em>CGI</em> variable
name (say, <tt>PATH_TRANSLATED</tt>), then this #set value will
be used.
<li><b>Technical note:</b> SRE-http stores #set variables in the
GLOBAL. stem, using a tail name of <tt>!varname</tt> (that is, preface
the <tt>varname</tt> with a <tt>!</tt>).
You can reference, or define, these variables in <TT>INTERPRET</tt>
<em>SRE-http style SSIs</em>.
<blockquote><em>For example, </em>, the following are equivalent:<br>
<code> <!-- #set var="monster" value="ghost" --> <br>
<!-- interpret code globals.!MONSTER="ghost" -->
<!-- interpret code GLOBALS.!MONSTER="wolf" -->
<!-- x #set var="monster" value="gho3st" ->
<br>Monster= <!-- #echo var="monster" -->
</blockquote>
</menu>
<b>EXAMPLE:</b> the below example will print "in foo" if the DOCUMENT_URI is
/foo/file.html, "in bar" if it is /bar/file.html and "in neither"
otherwise:
<PRE>
<!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\"" -->
in foo
<!--#elif expr="\"$DOCUMENT_URI\" = \"/bar/file.html\"" -->
in bar
<!--#else -->
in neither
<!--#endif -->
</PRE>
<a href="http://www.apache.org/docs/mod/mod_include.html">Need more
information on the Apache XSSI syntax?</a>
</body>
</html>