You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Brian Behlendorf <br...@hyperreal.com> on 1996/11/28 05:08:40 UTC

cvs commit: apache/htdocs/manual/mod mod_include.html

brian       96/11/27 20:08:39

  Modified:    htdocs/manual/mod  mod_include.html
  Log:
  Added text from Howard Fear on new functionality in 1.2's SSI.
  
  Revision  Changes    Path
  1.3       +114 -18   apache/htdocs/manual/mod/mod_include.html
  
  Index: mod_include.html
  ===================================================================
  RCS file: /export/home/cvs/apache/htdocs/manual/mod/mod_include.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -C3 -r1.2 -r1.3
  *** mod_include.html	1996/11/21 10:30:48	1.2
  --- mod_include.html	1996/11/28 04:08:38	1.3
  ***************
  *** 6,37 ****
    
    <BODY>
    <!--#include virtual="header.html" -->
  ! <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
    <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; -->
    
  ! <h2>SPML -- Include file Format</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>
  --- 6,42 ----
    
    <BODY>
    <!--#include virtual="header.html" -->
  ! <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
    <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>.
  ! 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>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>
    This command controls various aspects of the parsing. The valid attributes
    are:
    <dl>
  ***************
  *** 49,55 ****
    
    <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>.
  --- 54,59 ----
  ***************
  *** 61,74 ****
    
    <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
  --- 65,76 ----
  ***************
  *** 76,83 ****
    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
  --- 78,83 ----
  ***************
  *** 93,99 ****
    
    <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>
  --- 93,98 ----
  ***************
  *** 107,119 ****
    </dl>
    
    <dt><strong>flastmod</strong>
  ! <dd><!--%plaintext &lt;?INDEX {\tt exec} flastmod element&gt; -->
    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; -->
    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
  --- 106,118 ----
    </dl>
    
    <dt><strong>flastmod</strong>
  ! <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>
    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,152 ****
    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.
    </dl>
    
    <h2>Include variables</h2>
  ! These are available for the <code>echo</code> command, and to any program
  ! invoked by the document.
    <dl>
    <dt>DATE_GMT
    <dd>The current date in Greenwich Mean Time.
  --- 141,171 ----
    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>
  ! 
  ! 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.
  ***************
  *** 163,168 ****
  --- 182,264 ----
    <dd>The last modification date of the document requested by the user.
    </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>