SSI - Server Side Includes
Чтобы SSI выполнялись, необходимо задать в конфигурационных
файлах сервера:
/etc/httpd/conf/access.conf :------------------------
<Directory /home/httpd/docs> # "Включить"
Options All # Options Includes
/etc/httpd/conf/srm.conf :------------------------
AddType text/x-server-parsed-html .shtml
или даже
AddType text/x-server-parsed-html .html
SSI отрабатываются только в файлах с расширением .shtml
Примеры:
<!--#exec cmd="ls -l" -->
<!--#include virtual="bottom.html" -->
<!--#element attribute=value attribute=value ... -->
The value will often be enclosed in double quotes; many commands only allow a single attribute-value pair.
The allowed ELEMENTS are:
config - параметры парсинга
errmsg - сообщение об ошибке, посылаемое клиенту
sizefmt - формат размера файла
timefmt - формат даты модификации файла
var - напечатать имя переменной
exec - выполнить shell или CGI-скрипт
cgi - (%-encoded) URL relative path to the CGI script.
cmd - выполнить shell
fsize - напечатать размер файла
file - относительное имя файла
virtual -(%-encoded) URL-path relative файла
flastmod - последнее время модификации файла
include - вставить документ
file - вставляемый файл
virtual - URL - только на этом же хосте
Include variables
These are available for the echo command, and to any program
invoked by the document.
DATE_GMT
The current date in Greenwich Mean Time.
DATE_LOCAL
The current date in the local time zone.
DOCUMENT_NAME
The filename ( excluding directories) of the document requested
by the user.
DOCUMENT_URI
The (%-decoded) URL path of the document requested by the user.
Note that in the case of nested
include files, this is not then URL for the current document.
LAST_MODIFIED
The last modification date of the document requested by the user.
If server side includes are enabled, you will see data values below:
The date is: <!--#echo var="DATE_LOCAL"-->
The current version of the server <!--#echo var="SERVER_SOFTWARE"-->
The CGI gateway version <!--#echo var="GATEWAY_INTERFACE"-->
The server name <!--#echo var="SERVER_NAME"-->
This file is called: <!--#echo var="DOCUMENT_NAME"-->
This file's URI <!--#echo var="DOCUMENT_URI"-->
The query string <!--#echo var="QUERY_STRING_UNESCAPED"-->
This file was last modified: <!--#echo var="LAST_MODIFIED" -->
The size of the unprocessed file <!--#fsize virtual="httpd.txt"-->
sample.html was last modified <!--#flastmod virtual="httpd.txt"-->
You are using <!--#echo var="HTTP_USER_AGENT"-->
You came from <!--#echo var="HTTP_REFERER"-->
Содержание раздела