From: Ken Coar Date: Thu, 29 May 1997 12:00:07 +0000 (+0000) Subject: Enhanced documentation of variable substitution, and moved out X-Git-Tag: APACHE_1_2b11~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2e9132e3c6dab15906780c5c7cd693c0a54ac90;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/docs/manual/mod/mod_include.html b/docs/manual/mod/mod_include.html index 025643301a7..22c2c8a4591 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:
-<!--#element attribute=value attribute=value ... --> +<!--#element attribute=value attribute=value ... + -->
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 +(-->) should be preceded by whitespace to ensure that it +isn't considered part of an SSI token.

The allowed elements are:

@@ -184,14 +187,16 @@ output. Thus included files can be nested.

The value to give a variable. For example: - <!--#set var="category" value="help"--> + <!--#set var="category" value="help" -->
Apache 1.2 and above. -

Include variables

+

Include Variables

-In addition to the variables in the standard CGI environment, these are available for the echo command, for if and elif, and to any program invoked by the document. +In addition to the variables in the standard CGI environment, these are +available for the echo command, for if and +elif, and to any program invoked by the document.
DATE_GMT @@ -210,6 +215,51 @@ current document.

+

Variable Substitution

+

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 + config, + exec, + flastmod, + fsize, + include, and + set + directives, as well as the arguments to conditional operators. + You can insert a literal dollar sign into the string using backslash + quoting: + +

+    <!--#if expr="$a = \$test" -->
+
+ +

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, à la shell substitution: + +

+    <!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" -->
+
+ +

This will result in the Zed variable being set to + "X_Y" if REMOTE_HOST is + "X" and REQUEST_METHOD is + "Y". + +

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: +

+    <!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\"" -->
+    in foo
+    <!--#elif expr="\"$DOCUMENT_URI\" = \"/bar/file.html\"" -->
+    in bar
+    <!--#else -->
+    in neither
+    <!--#endif -->
+
+

Flow Control Elements

These are available in Apache 1.2 and above. The basic flow control @@ -256,12 +306,15 @@ elements are:
! test_condition
true if test_condition is false
test_condition1 && test_condition2 -
true if both test_condition1 and test_condition2 are true +
true if both test_condition1 and + test_condition2 are true
test_condition1 || test_condition2 -
true if either test_condition1 or test_condition2 is true +
true if either test_condition1 or + test_condition2 is true -

"=" and "!=" bind more tightly than "&&" and "||". +

"=" and "!=" bind more tightly than "&&" and + "||". "!" binds most tightly. Thus, the following are equivalent:

@@ -281,40 +334,6 @@ elements are:
     'string1    string2' results in string1    string2
 
-

Variable substitution is done within quoted strings. You can put - a dollar sign into the string using backslash quoting: - -

-    <!--#if expr="$a = \$test" -->
-
- -

If a variable reference needs to be substituted in the middle of a - string, it can be done by enclosing the reference in braces, - á la shell substitution: - -

-    <!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" -->
-
- -

will result in the Zed variable being set to - "X_Y" if REMOTE_HOST is - "X" and REQUEST_METHOD is - "Y". - -

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: -

-    <!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\""-->
-    in foo
-    <!--#elif expr="\"$DOCUMENT_URI\" = \"/bar/file.html\""-->
-    in bar
-    <!--#else -->
-    in neither
-    <!--#endif -->
-
- -

Directives