From: Rich Bowen text/x-server-parsed-html3
(and the resulting
output will have the mime type text/html
).
For more information, see our For more information, see our Tutorial on Server Side - Includes.
+ Includes.(none)
. Any dates printed are subject to the
- currently configured timefmt
. Attributes:
+ This command prints one of the include
+ variables, defined below. If the variable is unset, it
+ is printed as (none)
. Any dates printed are
+ subject to the currently configured timefmt
.
Attributes:
The CGI script is given the PATH_INFO and query string (QUERY_STRING) of the original request from the @@ -182,7 +182,7 @@ documents.
For example:
-<!--#exec cgi="/cgi-bin/example.cgi" -->
+ If the script returns a Location: header instead of
output, then this will be translated into an HTML
@@ -196,7 +196,10 @@ documents.
cgi, but can be done with include
virtual
, as shown here:
<!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
+ <!--#exec cmd="perl /path/to/perlscript arg1 arg2" -->
+ <!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
+ include virtual
should be used in preference
to exec cgi
to include the output of CGI
@@ -326,7 +333,9 @@ documents.
For example:
-<!--#printenv -->
The printenv element is available only in Apache 1.2 and above.
@@ -345,9 +354,11 @@ documents.
- For example: <!--#set var="category" value="help"
- -->
For example:
+ +The set element is available only in Apache 1.2 and above.
@@ -401,18 +412,19 @@ documents. 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, a 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 @@ -422,15 +434,16 @@ documents.
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 + +++ <!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\"" -->
+ in foo
+ <!--#elif expr="\"$DOCUMENT_URI\" = \"/bar/file.html\"" -->
+ in bar
+ <!--#else -->
+ in neither
<!--#endif --> -
- <!--#if expr="test_condition" --> - <!--#elif expr="test_condition" --> - <!--#else --> + +++ <!--#if expr="test_condition" -->
+ <!--#elif expr="test_condition" -->
+ <!--#else -->
<!--#endif --> -
The if
element works like an
if statement in a programming language. The test condition is
@@ -503,10 +517,11 @@ documents.
"=" and "!=" bind more tightly than "&&" and "||". "!" binds most tightly. Thus, the following are equivalent:
-- <!--#if expr="$a = test1 && $b = test2" --> + +++ <!--#if expr="$a = test1 && $b = test2" -->
<!--#if expr="($a = test1) && ($b = test2)" --> -
Anything that's not recognized as a variable or an operator is treated as a string. Strings can also be quoted: @@ -514,10 +529,11 @@ documents. (blanks and tabs) because it is used to separate tokens such as variables. If multiple strings are found in a row, they are concatenated using blanks. So,
-- string1 string2 results in string1 string2 - 'string1 string2' results in string1 string2 -+ +
string1 string2 results in string1 string2+
'string1 string2' results in string1 string2+
Files processed for server-side includes no longer accept
requests with PATH_INFO (trailing pathname information) by
- default. You can use the AcceptPathInfo directive to
+ default. You can use the
Note: you would not want to use the full
+ #include
a CGI
or otherwise produces different output on each hit (or could
- potentially change on subsequent requests).