ru en uk

  sing in

(044) 362 48 16   (098) 294 41 60


   Цены

   |      |      |   

What is SSI


The basic, simple, yet extremely powerful tool to support a large collection of documents is an SSI (Server-Side Includes - inclusion on the server side). If any of you know C, he quickly realizes that SSI is extremely similar to the macrooyazyk. With SSI, you can not just depending on some conditions show certain parts of the document, not only to build a document from the pre-defined pieces, but also to insert the output of a CGI script or program directly in the document.


In the standard distributionibutive Apache has a module mod_include. Since version 1.2 it has expanded the number of directives and is called - XSSI (eXtended SSI). By default it is included in the compilation.


The inclusion of a mechanism Server-Side Includes


Any document which will setexecution handler "server-parsed" will be scanned this module, if the option "Includes". If you have a small number of documents with SSI, it is best in the httpd.conf file as follows:
AddType text / html. Shtml <br>

and install these files from the expansion. shtml. If all or almost all documents will be directives SSI, it is better to specify the configuration file:
AddHandler server-parsed. Html

And Mr.e sure to include the option to host the directory (Directory, Virtual,. htaccess) option Includes:
Options + Includes

Of course, in this line may be other options you need.

Basic guidelines


SSI directives are included in HTML document in the form of comments (this does not prevent you from using the usual commentary). The syntax of the commands is as follows:
<!--# element attribute = value attribute = value ... ->

Very often, the value is placed in quotation marks. Some commands makes it possiblei only one attribute-value pair. Please note that the final part of the commentary (-->) be separated from the space directive, otherwise it will be perceived as a part of.

Consider some of the elements of Apache SSI:

  • config - controls various aspectsyou scan. His attributes are:

    1. errmsg - sets the message that bring on errors, in most cases be set to an empty string;
      This is the standard error when running the script, which does not have:
      <!--# exec cgi = & quot; / cgi-bin/nonexistence.pl "->
      Now we replace the error message and repeat:
      <!--# config errmsg = "Error, please contact the author of <a href=mailto:dh@null.ru> errors </ a >"-->
      <!--# exec cgi = "/ cgi-bin/nonexistence.pl" -> <BR>
      Conclusion:
      [an error occurred while processing this directive]
      Now we replace the error message and repeat:
      Error, please contact the author of errors

    2. sizefmt - sets the format in which tooutput file size. Format corresponding to the transmitted library function strftime; Directive config sizefmt alter the format of output file size.
      File size in kilobytes of this page:
      <!--# config sizefmt = "abbrev" ->
      <!--# fsize file = "ssi.shtml "-> <BR>
      File size in bytes of this page:
      <!--# config sizefmt = "bytes" ->
      <!--# fsize file = "ssi.shtml" -> <BR>
      Conclusion:
      File size in kilobytes of this page: 12k
      The file of this page in bytes: 12463

    3. timefmt - changing the output format of date and time.
      File modification time of this page in seconds from 01.01.1970:
      <!--# config timefmt = "% s" ->
      <!--# flastmod file = "ssi.shtml" -> <BR>
      File modification timeThis page in readable form:
      <!--# config timefmt = "% d.% m.% Y% H:% M:% S" ->
      <!--# flastmod file = "ssi.shtml" -> <BR>

      Conclusion:
      File modification time of this page in seconds with 01.01.1970: 961590693
      File modification time of this pageanitsy in readable form: 21.06.2000 16:31:33


    The parameters used in the config timefmt:





















    Format Description Sample
    % a AbbreviatuDr. names the day of the week Sun
    % A Full name of day of the week Sunday
    % b Abbreviation month names Jan
    % B The full name of the month January
    % d Day of month 01 (no 1)
    % D Date format "% m /% d /% y" 01/31/90
    % e Day of month 1
    % H Opened in the 24-hour format 13
    % I Opened in the 12-hour format 01
    % j Day of Year 235
    % m Number of months 01
    % M Minutes 03
    % p AM | PM AM
    % r Time in the format of "% I:% M:% S% p"
    % S Seconds 34
    % s Time in seconds from 01.01.1970 957228726
    % T Time in the format "% H:% M:% S" 14:05:34
    % U Week Year 49 % w Number of days a week 5
    % y Year in YY format 95
    % Y Year in YYYY format 1995
    % Z Time zone MSK


  • echo - displays PNachenie variables SSI. Valid attribute is the var.
    Your IP - <!--# echo var = "REMOTE_ADDR" -> <BR>
    Your browser - <!--# echo var = "HTTP_USER_AGENT" -> <BR>
    My server - <!--# echo var = "SERVER_NAME" - &gt; <BR>
    You came from - <!--# echo var = "HTTP_REFERER" -> <BR>

  • fsize - displays the file size in a specific format using sizefmt. Valid attributes:
  • file - specifies the file path on the targetpaper;
  • virtual - defines a standard encoded URL, on the scanned document, or, if in the beginning slash (/) - instruments with respect to the root node.
  • flastmod - displays date of last modification of file in a specific format using timefmt. Atributy similar attributes fsize.
  • include - includes the text of another document or file in the scanned file. To include files apply all the rules limiting access. If the catalog, which includes a file, the option IncludesNOEXEC, and the inclusion of thedocument would lead to the launch of the program, the document is not included, and receive an error message. CGI scripts are invoked, as usual using the URL, which may contain coded query string (query string). The situation indicates a file using the attributes:

    • file - a decreeyvaet way, on the scanned document, the path can not contain .. /, and can not be an absolute way, is always preferable to use the attribute virtual;
    • virtual - a coded URL, relative or absolute; URL can not contain the name of the protocol or the host name andmay contain a query string.

  • printenv - display the contents of environment variables. Called without parameters.
  • set - sets the value of a variable. Her attributes are the var, defines the variable name and value, which determines its value.
  • Variable inclusion


    In addition to the standard environment, CGI, SSI module makes available to the guidelines and conditions, as well as caused through SSI script the following variables:

    • DATE_GMT - the current time to UTC;
    • DATE_LOCAL --current local (for server) time;
    • DOCUMENT_NAME - file name (without directory) of the document requested by the user;
    • DOCUMENT_URI - decoded URL the user requested document;
    • LAST_MODIFIED - the date last modified, zaproshennogabout the user. That is embedded in the SSI, this variable will contain the name of "Chief" of the document, not attached.

    Variable


    Variable expansion is performed inside of quoting lines in most arguments, SSI Directorektiv. In these cases, you can insert a dollar sign, his preliminary quote:
    <!--# if expr = "$ a = $ test" ->

    To avoid ambiguity, you can enter the variable name in curly brackets:
    <!--# set var = "Zed" value = "; $ (a) bc_ $ (abc) "->

    As a result of this assigning variable Zed will have a value of "Xbc_Y", if a variable is equal to X, and the variable abc is equal to Y.

    Conditional operators


    The basic elements of control include:
    & lt ;!--# if expr = "test_condition" ->
    <!--# elif expr = "test_condition" ->
    <!--# else ->
    <!--# endif ->

    Elements of elif and else are optional.


    Endif element ends, and if the element is mandatory.


    test_condition may be one of the following:

    • string - true if the string is not empty;
    • string1 = string2
    • string1! = string2
    • string1 <string2
    • string1 <= string2
    • string1> string2
      </ li>
    • string1> = string2

    - True if the condition comparison. If string2 has the form / string /, then it is interpreted as regulyatnoe expression. Their syntax is similar to the syntax of regular expressions in Unix command egrep;

    • (Test_condition) - true if test_condition true;
    • ! test_condition - true if test_condition false;
    • test_condition1 & & test_condition2 - true, if both test_condition1, and test_condition2 true;
    • test_condition1 | | test_condition2 - truly,if at least test_condition1 or test_condition2 true.
    • "=" And "! =" Have a higher priority than "& &" and "||", a "!" has the highest priority.

    All that is not recognized as a variable, it is considered a string. Eswhether the string has spaces or tabs, then it must be enclosed in quotes.

 
How to send e-mail
29.05.2007
If you need to send a message to the administrator, the user, make a list, send your report by e-mail, the easiest way to do this with the help of embedded mail ()...
Working with databases
29.05.2007
The first thing you need to create dynamic pages - a database that will store all the information. Would you like to be able to view the contents of database tables, do the sample, add or update data? All this can be done using the built-in functions in PHP ...
Paginal output
29.05.2007

 

Rambler's Top100