summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_include.html
diff options
context:
space:
mode:
authorbrian <brian@unknown>1996-11-28 04:08:38 +0000
committerbrian <brian@unknown>1996-11-28 04:08:38 +0000
commit3f25760c651cc13f5c47060242ba24a2e0c0d7ff (patch)
treeffd604586fc3000c641e62647750c6ba011c4ae5 /docs/manual/mod/mod_include.html
parent5c93e241e43efe9ce294024d993c62e5ba8ba492 (diff)
downloadhttpd-3f25760c651cc13f5c47060242ba24a2e0c0d7ff.tar.gz
Added text from Howard Fear on new functionality in 1.2's SSI.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@77076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs/manual/mod/mod_include.html')
-rw-r--r--docs/manual/mod/mod_include.html132
1 files changed, 114 insertions, 18 deletions
diff --git a/docs/manual/mod/mod_include.html b/docs/manual/mod/mod_include.html
index b01b8985da..f8466ed9e9 100644
--- a/docs/manual/mod/mod_include.html
+++ b/docs/manual/mod/mod_include.html
@@ -6,32 +6,37 @@
<BODY>
<!--#include virtual="header.html" -->
-<H1>Module mod_include</h1>
+<H1>Module mod_include</H1>
This module is contained in the <code>mod_include.c</code> file, and
-is compiled in by default. It provides for server-parsed html documents,
-known as SPML documents.
-Any document with mime type <code>text/x-server-parsed-html</code> or
+is compiled in by default. It provides for server-parsed html
+documents, known as SPML documents. Any document with mime type
+<code>text/x-server-parsed-html</code> or
<code>text/x-server-parsed-html3</code> will be parsed by this module,
with the resulting output given the mime type <code>text/html</code>.
-<!--%plaintext &lt;?INDEX {\tt text/x-server-parsed-html} mime type&gt; -->
-<!--%plaintext &lt;?INDEX {\tt text/x-server-parsed-html3} mime type&gt; -->
+Several directives beyond the original NCSA SPML definition have been
+included in Apache 1.2 - these are flagged below with the phrase
+"Apache 1.2 and above". Of particular significance are the new flow
+control directives documented at the bottom.
-<h2>SPML -- Include file Format</h2>
+<h2>Basic Elements</h2>
The document is parsed as an HTML document, with special commands embedded
as SGML comments. A command has the syntax:
+
<blockquote><code>
&lt;!--#</code><em>element attribute=value attribute=value ...</em> <code>--&gt;
</code></blockquote>
+
The value will often be enclosed in double quotes; many commands only allow
a single attribute-value pair.
<p>
The allowed elements are:<p>
+
<dl>
+
<dt><strong>config</strong>
<dd>
-<!--%plaintext &lt;?INDEX {\tt config} SPML element&gt; -->
This command controls various aspects of the parsing. The valid attributes
are:
<dl>
@@ -49,7 +54,6 @@ routine when printing dates.
<dt><strong>echo</strong>
<dd>
-<!--%plaintext &lt;?INDEX {\tt echo} SPML element&gt; -->
This command prints one of the include variables, defined below.
If the variable is unset, it is printed as <code>(none)</code>.
Any dates printed are subject to the currently configured <code>timefmt</code>.
@@ -61,14 +65,12 @@ Attributes:
<dt><strong>exec</strong>
<dd>
-<!--%plaintext &lt;?INDEX {\tt exec} SPML element&gt; -->
The exec command executes a given shell command or CGI script.
The IncludesNOEXEC <A HREF="core.html#options">Option</A> disables this command
completely. The valid attributes are:
<dl>
<dt>cgi
<dd>
-<!--%plaintext &lt;?INDEX CGI scripts, {\tt exec} element and&gt; -->
The value specifies a (%-encoded) URL relative path to the CGI script.
If the path does not begin with a (/), then it is taken to be relative to
the current document. The document referenced by this path is invoked
@@ -76,8 +78,6 @@ as a CGI script, even if the server would not normally recognise it as
such. However, the directory containing the script must be enabled for
CGI scripts (with <A HREF="mod_alias.html#scriptalias">ScriptAlias</A>
or the ExecCGI <A HREF="core.html#options">Option</A>).<p>
-<!--%plaintext &lt;?INDEX PATH\_INFO CGI variable&gt; -->
-<!--%plaintext &lt;?INDEX QUERY\_STRING CGI variable&gt; -->
The CGI script is given the PATH_INFO and query string (QUERY_STRING) of the
original request from the client; these cannot be specified in the URL path.
The include variables will be available to the script in addition to the
@@ -93,7 +93,6 @@ The include variables are available to the command.
<dt><strong>fsize</strong>
<dd>
-<!--%plaintext &lt;?INDEX {\tt fsize} SPML element&gt; -->
This command prints the size of the specified file, subject to the
<code>sizefmt</code> format specification. Attributes:
<dl>
@@ -107,13 +106,13 @@ to the current document.
</dl>
<dt><strong>flastmod</strong>
-<dd><!--%plaintext &lt;?INDEX {\tt exec} flastmod element&gt; -->
+<dd>
This command prints the last modification date of the specified file,
subject to the <code>timefmt</code> format specification. The attributes are
the same as for the <code>fsize</code> command.
<dt><strong>include</strong>
-<dd><!--%plaintext &lt;?INDEX {\tt include} SPML element&gt; -->
+<dd>
This command inserts the text of another document or file into the parsed
file. Any included file is subject to the usual access control. If the
directory containing the parsed file has the
@@ -142,11 +141,31 @@ is taken to be relative to the current document.
A URL is constructed from the attribute, and the output the server
would return if the URL were accessed by the client is included in the parsed
output. Thus included files can be nested.
+
+<dt><strong>printenv</strong>
+<dd>This prints out a listing of all existing variables and their values.
+ No attributes.
+<dd>For example: <code>&lt;!--#printenv --&gt;</code>
+<dd>Apache 1.2 and above.
+
+<dt><strong>set</strong>
+<dd>This sets the value of a variable. Attributes:
+<dl>
+<dt>var
+<dd>The name of the variable to set.
+<dt>value
+<dd>The value to give a variable.
+</dl>
+For example:
+ <CODE>&lt;!--#set var="category" value="help"--&gt;</CODE>
+<dd>Apache 1.2 and above.
+
</dl>
<h2>Include variables</h2>
-These are available for the <code>echo</code> command, and to any program
-invoked by the document.
+
+In addition to the variables in the standard CGI environment, these are available for the <code>echo</code> command, for <code>if</code> and <code>elif</code>, and to any program invoked by the document.
+
<dl>
<dt>DATE_GMT
<dd>The current date in Greenwich Mean Time.
@@ -164,6 +183,83 @@ current document.
</dl>
<p>
+<H2>Flow Control Elements</H2>
+
+These are available in Apache 1.2 and above. The basic flow control
+elements are:
+
+<PRE>
+ &lt;!--#if expr="<I>test_condition</I>" --&gt;
+ &lt;!--#elif expr="<I>test_condition</I>" --&gt;
+ &lt;!--#else --&gt;
+ &lt;!--#endif --&gt;
+</PRE>
+
+<P> 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 be used the put text into the output stream
+ if the original test_condition was false. These elements
+ are optional.
+
+<P> The <B><CODE>endif</CODE></B> element ends the
+ <B><CODE>if</CODE></B> element and is required.
+
+<P> <I>test_condition</I> is one of the following:
+
+<DL>
+
+<DT><I>string</I><DD>true if <I>string</I> is not empty
+
+<DT><I>string1</I> = <I>string2</I><BR>
+ <I>string1</I> != <I>string2</I>
+
+<DD>Compare string1 with string 2. If string2 has the form <I>/string/</I>
+ than it is compared as a regular expression.
+ Regular expressions have the same syntax as those found in the
+ Unix egrep command.
+
+<DT>( <I>test_condition</I> )<DD>true if <I>test_condition</I> is true
+<DT>! <I>test_condition</I><DD>true if <I>test_condition</I> is false
+ <I>test_condition1</I> and <I>test_condition2</I> are true
+<DT><I>test_condition1</I> && <I>test_condition2</I><DD>true if both
+ <I>test_condition1</I> and <I>test_condition2</I> are true
+<DT><I>test_condition1</I> || <I>test_condition2</I><DD>true if either
+ <I>test_condition1</I> or <I>test_condition2</I> is true
+</DL>
+
+<P> "<I>=</I>" and "</I>!=</I>" bind more tightly than "<I>&&</I>" and "<I>||</I>".
+ "<I>!</I>" binds most tightly. Thus, the following are equivalent:
+
+<PRE>
+ &lt;!--#if expr="$a = test1 && $b = test2" --&gt;
+ &lt;!--#if expr="($a = test1) && ($b = test2)" --&gt;
+</PRE>
+
+<P> Anything that's not recognized as a variable or an operator is
+ treated as a string. Strings can also be quoted: <I>'string'</I>.
+ Unquoted strings can't contain whitespace (blanks and tabs)
+ because it is used to seperate tokens such as variables. If
+ multiple strings are found in a row, they are concatenated using
+ blanks. So,
+
+<PRE>
+ <I>string1 string2</I> results in <I>string1 string2</I>
+ <I>'string1 string2'</I> results in <I>string1 string2</I>
+</PRE>
+
+<P> Variable substitution is done within quoted strings. You can put
+ a dollar sign into the string using backslash quoting:
+
+<PRE>
+ &lt;!--#if expr="$a = \$test" --&gt;
+</PRE>
+
<hr>
<h2>Directives</h2>