SHTML thin tutorial

xiaoxiao2021-04-05  251

SHTML thin tutorial

What is the use of SSI? The reason why SSI is because SHTML - Server-Parsed HTML's initial thumbnail. The HTML text containing the embedded server contains the command. Before being transferred to the browser, the server reads, analyzes, and modifications to the SHTML document. SHTML and ASP have some similar, in a file named after SHTML, use SSI's instructions, just like the instructions in the ASP, you can write SSI instructions in the SHTML file, when the client accesss these SHTML files, the server side These SHTML files will be read and interpreted, and the SSI instructions contained in the SHTML file are explained, for example, you can use the SSI directive to reference other HTML files (#include) in the SHTML file, the server is transmitted to the client file, is The Explaced SHTML does not have an SSI directive. It implements the features of HTML, that is, dynamic SHTML can be said to be an evolution of HTML. The news system like Sina is like this, and the news content is fixed but it's the advertisements and menus above it is incorporated by #include. Currently, there are several uses: 1. Display server-side environment variables <#echo> 2, plug the text directly into the document <#include> 3, display web document related information <#flastmod #fsize> (such as Document production date / size, etc.) 4, directly execute various programs <#exec> (such as CGI or other executable) 5, set SSI information display format <#config> (such as file production date / size display mode) Advanced SSI can set the variable using the IF condition statement. Using SSI SSI is a set of commands provided for web servers, which can be embedded directly into the annotation content of the HTML document. Such as: is an SSI directive, its role is to copy "info.htm" to the current page, when the visitor is browsing, The contents of Info.htm are displayed like other HTML documents. Other SSI instructions are basically similar to the examples, and it can be seen that SSI use is only inserted into a point, and the form is very simple. Of course, if the web server does not support SSI, it will simply use it as a comment message, skip them directly; the browser will ignore this information. How do I configure SSI function on my web server? On some web servers (such as IIS 4.0 / Sambar 4.2), the file containing the #include command must use the extension that has been mapped to the SSI interpreter; otherwise, the web server will not process the SSI directive; default, expand Name .stm, .shtm and .shtml are mapped to the interpretation program (SSINC.DLL). Apache is based on your settings, modify SRM.conf as: addtype text / x-server-pased-html .shtml will only be paired with the .shtml extension file resolution SSI command addtype text / x-server-parse- HTML .html will use the Administration Netscape Web server to open SSI features directly using the Administration Server (Managing Server) for all HTML documents.

Website uses the mapping tab in the Server Admin program, the extension adds the content type to: WWWServer / HTML-SSI CERN server does not support SSI, SSI fraud method can be used, to http://sw.cse.bris.ac.uk/webtools/ Fakessi.html downloads a Perl script to make your CERN server use some SSI instructions. (Do not support EXEC instructions.) SSI directive basic format SSI instruction basic format: program code: Data Code: Description: 1. is a comment in the HTML syntax, which is ignored when the web server does not support SSI. 2. #include is one of the SSI instructions. 3. FILE is the parameter of the include, INFO.HTM is the parameter value, refers to the document name to be included in this instruction. Note: 1. This document name: Program code: Today: Program code: Your IP address is the program code: #include demonstration: Will the content of the text file Plug directly into the document page. Syntax: Program code: File file name is a relative path that is located relative to the directory where the documentation using the #include instruction. The included files can be in the same level directory or their subdirectories, but cannot be in the previous directory. As indicating the NAV_HEAD.htm document in the current directory, File = "NAV_HEAD.HTM". The Virtual file name is the full path to the virtual directory on the Web site.

As indicating the NAV_HEAD.htm file under the HOYI directory relative to the server document; the file = "/ hoyi / nav_head.htm" parameter: file specifies that the location Virtual specified by the file relative to this document is specified relative to the server document root directory. Location Note: 1. The file name must have an extension. 2. The file being included can have any file extensions. I feel that I use the HTM extension directly, Microsoft recommends using the .inc extension (this will look at your hobby). Example: Program code: Plug the header file into the current page Insert the tail file into the current Page Plug the header file into the current page Insert the tail file into the current page #flastmod and #fSize Demonstration: #flastmod file Recent update date #fsize file length syntax: program code: parameter: file specifying the location of the included file relative to this document, such as info.txt means the current directory The underfo.txt document Virtual specifies that the location relative to the root directory of the server document is as good as /hi/info.txt: The file name must have an extension. Example: program code: Recent updated date of the news.htm file in the current directory Plug in the current page program code: Size of the news.htm in the current directory To the current page #EXEC Demonstration: Insert an output of an external program into the page. You can insert the CGI program or the input of the regular application, depending on the parameter used is CMD or CGI. Syntax: program code: Parameters: CMD General Application CGI CGI Script Program: Program Code: will Display password file will display the list of files in the current directory will Perform the CGI program GB.cgi.

will execute the CGI program access_log.cgi. The password file will be displayed will display the list of files in the current directory will execute the CGI program GB.cgi. will execute the CGI program access_log.cgi. Note: From the example above, this instruction is quite convenient, but there is also a security problem. Prohibited method:. Apache deletes the line code of "Options Includes Execcgi" in Access.conf; In IIS, you want to disable the #exec command to modify the ssiexecdisable metabase; #config: Specifies the format that returns to the client browser, the date, and file size format. Syntax: Program code: parameters : Errmsg Custom SSI executes error messages, you can do anything you like. Sizefmt file size display mode, the default is byte mode ("Bytes") can be changed to the kilobyte mode ("Abbrev") Timefmt time display mode, the most flexible configuration properties.

Example: Displaying a size program code that does not exist file: Display file size in kilobyte mode: Show time program code at a specific time format: Show Today is the week, a few months, time zone Show Today is the week, a few months, time zone xssi xssi (extended ssi) is a set of advanced SSI instructions, built in Apache 1.2 or more High versions of MOD-INCLUDE modules. Among them, the instructions are: #printenv #set #if #printenv effect: Displays all environment variables currently existing in the web server environment. Syntax: Program code: Parameters: None Example: Program Code: # SET effect: The variable can be assigned to the following IF statement.

Syntax: program code: parameter: no Example: program code: #IF role: Creation can change The data of the data, which is displayed in accordance with the requirements calculated when using the IF statement. Syntax: Program code: Display content Display content Display content Display content Display content display content Example: Program Code: Welcome to CGI factory in Zibo hotline http: //hoyi.zb169 .NET. Welcome to CGI factory in Sun City's sub-station http://linux.cqi.com.cn / ~ hoyi. Welcome to the CGI factory! Welcome to the CGI factory in Zibo hotline http: / /hoyi.zb169.net. Welcome to CGI factory in Sun City's sub-station http: // Linux.cqi.com.cn/~hoyi. Welcome to the CGI factory! Note: For the backslash in the front instruction, it is It is used to change the quotation of the inside so that they will not be interpreted as ending expressions. Not eliminating. 1. The config command The config command is primarily used to modify the default settings of the SSI. Where: errmsg: Sets the default error message. In order to be able to return the user setting error information, the errmsg parameter must be placed in front of the other SSI command in the HTML file, otherwise the client can only display the default error message instead of the custom information set by the user.

Timefmt: Define the date and time of the usage format .TimeFmt parameter must be used before the echo command. The result is: Wednesday, April 12, 2000 maybe the user is using% a% B used in the previous example. % D is very unfamiliar, we will summarize some of the more common date and time formats in SSI in the form of a table. Sizefmt: Decideting the file size is byte, the kiloby is also a megabyte means. If words In the unit, the parameter value is "bytes"; the quartzen form can be used for kilobytes and megabytes. Similarly, the sizefmt parameter must be placed in front of the fsize command. 2, the incrude command The include command can insert the text or image in other documents into the currently resolved document, this is the key to the entire SSI. With the include command, you can update the entire site when you need to change a file! The include command has two different parameters: Virtual: Gives the virtual path to the server side a document. For example: file: Give the relative path to the current directory, where" ../ "cannot be used, and the absolute path cannot be used. For example: This requires every directory containing a header.html file. 3, the echo command echo command can display the following environment variables: Document_name: Displays the name of the current document. The result is: index.html document_uri: Displays the virtual path of the current document. For example: The result is: / Your Directory / YourFileName.html With the continuous development of the website, those increasingly long URL addresses will definitely make people a distress. If you use SSI, everything will be solved. Because we can combine the domain name of the website and the SSI command to display the complete URL, ie: http:// youriMain query_string_unescaped: Show uncontrolled processed by customers The query string sent by the end, where all of the special characters have escape characters "/". For example: Date_local: Displays the date and time of the server setting time zone.

The user can customize the output information in conjunction with the TIMEFMT parameters of the config command. For example: The result is: Saturday, The 15 of april, in the year 2000 date_gmt: The function is the same as Date_Local, but returns to the date based on the Greenwich standard time. For example: Last_Modified: Displays the last update time of the current document. Similarly, this is a very practical feature in SSI, as long as the following simple text is added to the HTML document, you can update the update time on the page. CGI Environment Variable In addition to the SSI environment variable, the echo command can also display the following CGI environment variables: Server_software: Displays the name and version of the server software. For example: Server_name: Displays the host name, DNS alias or IP address of the server. For example: Server_Protocol: Displays the protocol name and version used by the client request, such as HTTP / 1.0. For example: Server_port: Displays the server's response port. For example: Request_method: Displays the client's document request method, including get, head, and post. For example: remote_host: Displays the client host name that issues request information. remote_addr: Displays the client IP address that issues request information. auth_type: Displays the authentication method of the user identity. remote_user: Displays the account name used by the user who is accessing the protected page. 4, fsize: Displays the size of the specified file, which can be customized in conjunction with the SIZEFMT parameter of the config command. 5, FLASTMOD: Displays the final modification date of the specified file, can combine the TIMEFMT parameter control output format for the config command.

Here we can use FlastMod The parameter shows the update date of all links on a page. The method is as follows: file Another file display result For: File April 19, 2000 Another File January 08, 2000 6, the exec exec command can execute the CGI script or shell command. The method is as follows: CMD: Use / bin / SH to perform the specified string. If the SSI uses the IncludeSnoExec option, the command will be blocked. CGI: Can be used to perform the CGI script. For example, in this example, use the counter.pl scripker under the Directory of the Directory in each page to place a counter at each page: :

Http://www.webjx.com/htmldata/2005-12-04/1133660620.html

转载请注明原文地址:https://www.9cbs.com/read-131979.html

New Post(0)