diff options
author | Ken Coar <coar@apache.org> | 1997-05-29 12:00:07 +0000 |
---|---|---|
committer | Ken Coar <coar@apache.org> | 1997-05-29 12:00:07 +0000 |
commit | b2e9132e3c6dab15906780c5c7cd693c0a54ac90 (patch) | |
tree | bd153d0c77d01164af567ce9e0faf7572caf4530 | |
parent | 98dc17682a74b0cb459f6984ef13552c297c50aa (diff) | |
download | httpd-b2e9132e3c6dab15906780c5c7cd693c0a54ac90.tar.gz |
Enhanced documentation of variable substitution, and moved out
the `flow control' section to its own. (PR#545)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@78186 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | docs/manual/mod/mod_include.html | 104 |
1 files changed, 61 insertions, 43 deletions
diff --git a/docs/manual/mod/mod_include.html b/docs/manual/mod/mod_include.html index 025643301a..22c2c8a459 100644 --- a/docs/manual/mod/mod_include.html +++ b/docs/manual/mod/mod_include.html @@ -52,11 +52,14 @@ The document is parsed as an HTML document, with special commands embedded as SGML comments. A command has the syntax: <blockquote><code> -<!--#</code><em>element attribute=value attribute=value ...</em> <code>--> +<!--#</code><em>element attribute=value attribute=value ...</em> +<code> --> </code></blockquote> The value will often be enclosed in double quotes; many commands only allow -a single attribute-value pair. +a single attribute-value pair. Note that the comment terminator +(<SAMP>--></SAMP>) should be preceded by whitespace to ensure that it +isn't considered part of an SSI token. <p> The allowed elements are:<p> @@ -184,14 +187,16 @@ output. Thus included files can be nested. <dd>The value to give a variable. </dl> For example: - <CODE><!--#set var="category" value="help"--></CODE> + <CODE><!--#set var="category" value="help" --></CODE> <dd>Apache 1.2 and above. </dl> -<h2>Include variables</h2> +<h2>Include Variables</h2> -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. +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 @@ -210,6 +215,51 @@ current document. </dl> <p> +<H2>Variable Substitution</H2> +<P> Variable substitution is done within quoted strings in most cases + 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. + You can insert a literal dollar sign into the string using backslash + quoting: + +<PRE> + <!--#if expr="$a = \$test" --> +</PRE> + +<P> 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, <EM>à la</EM> shell substitution: + +<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>". + +<P> EXAMPLE: 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> + <H2>Flow Control Elements</H2> These are available in Apache 1.2 and above. The basic flow control @@ -256,12 +306,15 @@ elements are: <DT>! <I>test_condition</I> <DD>true if <I>test_condition</I> is false <DT><I>test_condition1</I> && <I>test_condition2</I> - <DD>true if both <I>test_condition1</I> and <I>test_condition2</I> are true + <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 + <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>". +<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> @@ -281,40 +334,6 @@ elements are: <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> - <!--#if expr="$a = \$test" --> -</PRE> - -<P> If a variable reference needs to be substituted in the middle of a - string, it can be done by enclosing the reference in braces, - <EM>á la</EM> shell substitution: - -<PRE> - <!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" --> -</PRE> - -<P> 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>". - -<P> EXAMPLE: 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> - - <hr> <h2>Directives</h2> <ul> @@ -357,4 +376,3 @@ the request. <!--#include virtual="footer.html" --> </BODY> </HTML> - |