ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaie_5.4.0.1/rzaiessicommands.htm

311 lines
17 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="topic" />
<meta name="DC.Title" content="Server-side include commands for HTTP Server" />
<meta name="abstract" content="This topic provides information about server-side include (SSI) commands for the HTTP Server (powered by Apache)." />
<meta name="description" content="This topic provides information about server-side include (SSI) commands for the HTTP Server (powered by Apache)." />
<meta name="DC.Relation" scheme="URI" content="rzaiereference.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2002,2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2002,2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzaiessicommands" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Server-side include commands for HTTP Server</title>
</head>
<body id="rzaiessicommands"><a name="rzaiessicommands"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Server-side include commands for HTTP Server</h1>
<div><p>This topic provides information about server-side include (SSI)
commands for the HTTP Server (powered by Apache). </p>
<div class="important"><span class="importanttitle">Important:</span> Information
for this topic supports the latest PTF levels for HTTP Server for i5/OS .
It is recommended that you install the latest PTFs to upgrade to the latest
level of the HTTP Server for i5/OS. Some of the topics documented here are
not available prior to this update. See <a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/services/service.html" target="_blank">http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm</a> <img src="www.gif" alt="Link outside Information Center" /> for more information. </div>
<p></p>
<p>Server-side includes allow you to insert information into CGI programs
and HTML documents that the server sends to the client. </p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaiereference.htm" title="This topic provides additional reference documentation for HTTP Server and the IBM Web Administration for i5/OS interface.">Reference documentation for HTTP Server</a></div>
</div>
</div><div class="hr" id="pba"><a name="pba"><!-- --></a><h2 class="topictitle2">Server-side include commands for HTTP Server (powered by Apache) </h2>
<div><p>HTTP Server (powered by Apache) SSI commands have the following format:
</p>
<pre class="block">&lt;--#command parameter="value --&gt;</pre>
<div class="note"><span class="notetitle">Note:</span> There is a space before --&gt;. </div>
<p>The following describes the SSI commands for HTTP Server (powered by Apache).</p>
</div>
<div class="hr" id="echo"><a name="echo"><!-- --></a><h3 class="topictitle3">echo</h3>
<div><p>This command prints one of the SSI or API variables. Dates are printed
using config timefmt. The attributes are: </p>
<dl><dt class="dlterm">var</dt>
<dd>Specifies an environment variable name or CGI environment variable name.
</dd>
<dd class="ddexpand">See the Environment variables on HTTP Server topic for a list of environment
variables. <p>For example:</p>
<pre>&lt;!--#echo var="DATE_GMT" --&gt;</pre>
</dd>
</dl>
<dl><dt class="dlterm">encoding</dt>
<dd>Specifies how the server encodes special characters contained in the variable.
If set to none, no encoding is done. If set to url, then URL encoding (or
%-encoding) is performed. If set to the default of entity, then entity encoding
is performed. <p>For example: </p>
<pre>&lt;!--#echo encoding="none" --&gt;</pre>
</dd>
</dl>
</div>
</div>
<div class="hr" id="exec"><a name="exec"><!-- --></a><h3 class="topictitle3">exec</h3>
<div><p>This command calls a CGI program. The attributes are: </p>
<dl><dt class="dlterm">cgi</dt>
<dd>Specifies the relative path and file name. For example: <pre>&lt;!--#exec cgi="/cgi-bin/counter.pgm" --&gt;</pre>
</dd>
</dl>
</div>
</div>
<div class="hr" id="fsize"><a name="fsize"><!-- --></a><h3 class="topictitle3">fsize</h3>
<div><p>This command prints the size of the specified file according to <strong>config
sizefmt</strong>. The attributes are: </p>
<dl><dt class="dlterm">file</dt>
<dd>Specifies the relative path and file name. For example: <pre>&lt;!--#fsize virtual="/include/include.htm" --&gt;</pre>
</dd>
</dl>
<dl><dt class="dlterm">virtual</dt>
<dd>Specifies the relative path and file name using URL encoding. For example: <pre>&lt;!--#fsize virtual="/include/include.htm" --&gt;</pre>
</dd>
</dl>
</div>
</div>
<div class="hr" id="flastmod"><a name="flastmod"><!-- --></a><h3 class="topictitle3">flastmod</h3>
<div><p>This command prints the last modification date of the specified file according
to <strong>config timefmt</strong>. The attributes are: </p>
<dl><dt class="dlterm">file</dt>
<dd>Specifies the relative path and file name. For example: <pre>&lt;!--#flastmod file="/include/include.htm" --&gt;</pre>
</dd>
</dl>
<dl><dt class="dlterm">virtual</dt>
<dd>Specifies the relative path and file name using URL encoding. For example: <pre>&lt;!--#flastmod virtual="/include/include.htm" --&gt;</pre>
</dd>
</dl>
</div>
</div>
<div class="hr" id="global"><a name="global"><!-- --></a><h3 class="topictitle3">global</h3>
<div><p>This command is the same as the <a href="#set">set</a> command. </p>
</div>
</div>
<div class="hr" id="include"><a name="include"><!-- --></a><h3 class="topictitle3">include</h3>
<div><p>This command inserts the text of another file. Included files can be nested.
The attributes are: </p>
<dl><dt class="dlterm">file</dt>
<dd>Specifies the relative path and file name. For example: <pre>&lt;!--#include file="/include/include.htm" --&gt;</pre>
</dd>
</dl>
<dl><dt class="dlterm">virtual</dt>
<dd>Specifies the relative path and file name using URL encoding. For example: <pre>&lt;!--#include virtual="/include/include.htm" --&gt;</pre>
</dd>
</dl>
</div>
</div>
<div class="hr" id="printenv"><a name="printenv"><!-- --></a><h3 class="topictitle3">printenv</h3>
<div><p>This command prints all existing environment variables and their values.
There are no attributes. For example: </p>
<pre class="block">&lt;!--#printenv --&gt;</pre>
</div>
</div>
<div class="hr" id="set"><a name="set"><!-- --></a><h3 class="topictitle3">set</h3>
<div><p>This command sets the value of an environment variable. The attributes
are: </p>
<dl><dt class="dlterm">var</dt>
<dd>Specifies an environment variable name.<p>See <a href="rzaieenvvar.htm">Environment variables on HTTP Server</a> for a list of environment variables. </p>
</dd>
</dl>
<dl><dt class="dlterm">value</dt>
<dd>Specifies the value to assign to the environment variable name. For example: <pre>&lt;!--#set var="var1" value="yes" --&gt;</pre>
<p>If
you want to insert a special character in a string, precede it with a \. For
example: </p>
<pre>&lt;!--#set var="var1" value="\$Date_GMT" --&gt;</pre>
</dd>
</dl>
</div>
</div>
<div class="hr" id="conditional_commands"><a name="conditional_commands"><!-- --></a><h3 class="topictitle3">Conditional commands</h3>
<div><p>There are four conditional or flow control commands. The <strong>if</strong> command
tests a value. If the value is true, then processing continues with the next
line. If the value is not true then processing continues with an <strong>elif</strong>, <strong>else</strong>,
or <strong>endif</strong> command. The <strong>elif</strong> and <strong>else</strong> commands are optional.
The <strong>if</strong> and <strong>elif</strong> commands have a parameter of <strong>expr</strong>. The <strong>expr</strong> parameter
contains the test condition. An <strong>endif</strong> command is required for every
if command. For example: </p>
<pre class="block">&lt;!--#if expr="$USER_AGENT = /MSIE/" --&gt;
&lt;P&gt;You are using Internet Explorer.&lt;/P&gt;
&lt;!--#elif expr="$USER_AGENT = /Mozilla/" --&gt;
&lt;P&gt;You are using Netscape.&lt;/P&gt;
&lt;!--#else --&gt;
&lt;P&gt;You are not using Internet Explorer or Netscape.&lt;/P&gt;
&lt;!--#endif --&gt;</pre>
<p>The <strong>expr</strong> parameter can have one of the following forms: </p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="56.84210526315789%" id="d0e264">Condition</th>
<th valign="top" width="43.15789473684211%" id="d0e266">Comments</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string</samp></td>
<td valign="top" width="43.15789473684211%" headers="d0e266 ">True if the string is not empty</td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string1 = string2 (equal) </samp></td>
<td rowspan="6" valign="top" width="43.15789473684211%" headers="d0e266 "><p>Compare string1 with string2. If string2
has the form /string/, then it is compared as a regular expression. See <a href="rzaieregexpnot.htm">Regular expression notation for HTTP Server</a> for more information.</p>
</td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string1 != string2 (not equal) </samp></td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string1 &lt; string2 (less than) </samp></td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string1 &lt;= string2 (less than or equal to) </samp></td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string1 &gt; string2 (greater than) </samp></td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">string1 &gt; = string2 (greater than or equal to)</samp></td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">( test_condition ) </samp></td>
<td valign="top" width="43.15789473684211%" headers="d0e266 "><p>True if test_condition is true. </p>
</td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">!test_condition</samp></td>
<td valign="top" width="43.15789473684211%" headers="d0e266 "><p>True if test_condition is false. </p>
</td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">Test_condition1 &amp;&amp; test_condition2 </samp></td>
<td valign="top" width="43.15789473684211%" headers="d0e266 "><p>True if both test_condition1 and test_condition2
are true. </p>
</td>
</tr>
<tr><td valign="top" width="56.84210526315789%" headers="d0e264 "><samp class="codeph">Test_condition1 || test_condition2 </samp></td>
<td valign="top" width="43.15789473684211%" headers="d0e266 "><p>True if either test_condition1 or test_condition2
are true. </p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="hr" id="variable_substitution"><a name="variable_substitution"><!-- --></a><h3 class="topictitle3">Variable substitution </h3>
<div><p>Values can be supplied in the following ways: </p>
<ul><li>Test can be supplied within a quoted string. For example:<pre>&lt;!--#config timefmt="%b%d%y" --&gt;</pre>
</li>
<li>A literal dollar sign can be supplied in a string using a backslash. For
example:<pre>&lt;!--#ifexpr="$a=\$test" --&gt;</pre>
</li>
<li>A variable reference can be supplied within a character sequence using
braces. For example:<pre>&lt;!--#set var="ABC" value="${REMOTE_HOST}_${REQUEST_METHOD}" --&gt;</pre>
<p>If <tt>REMOTE_HOST</tt> is
equal to <tt>X</tt> and <tt>REQUEST_METHOD</tt> is equal to <tt>Y</tt>, then <tt>$ABC</tt> is
equal to <tt>X_Y</tt>.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="hr" id="additional_notes"><a name="additional_notes"><!-- --></a><h2 class="topictitle2">Additional notes</h2>
<div><p>Server-side includes look for the variable, echoes where the variable is
found, and proceeds with the function. You can have multiple variable references.
When server-side includes encounter a variable reference inside a server-side
include directive, it attempts to resolve it on the server side. The following
example escapes the &amp; so that server-side includes do not recognize it
as a variable. In the second line of the example, the variable "&amp;index"
is a server-side variable and is used to construct the variable name "var1".
The variable &amp;ecirc; is a client side variable, so the &amp; is escaped
to create the value ":fr&amp;ecirc;d" or "fred" with a circumflex over the
e. </p>
<pre class="block">&lt;!--#set var="index" value="1" --&gt;
&lt;!--#set var+"var&amp;index;" value+"fr\&amp;ecirc;d" --&gt;
&lt;!--#echo var="var1" --&gt; </pre>
<p>The following characters can be escaped. Escape variables must be preceded
with a backslash (\). </p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="48.484848484848484%" id="d0e388">Escape variable</th>
<th valign="top" width="51.515151515151516%" id="d0e390">Meaning</th>
</tr>
</thead>
<tbody><tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\a</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Alert (bell)</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\b</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Backslash</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\f</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Form feed (new page)</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\n</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>New line</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\r</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Carriage return</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\t</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Vertical tab</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\v</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Vertical tab</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\'</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Single quote mark</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\''</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Double quote mark</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\?</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Question mark</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\\</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Backslash</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\-</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Hyphen</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\.</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Period</p>
</td>
</tr>
<tr><td valign="top" width="48.484848484848484%" headers="d0e388 "><samp class="codeph">\&amp;</samp></td>
<td valign="top" width="51.515151515151516%" headers="d0e390 "><p>Ampersand</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>