SHTML tutorial
What is SHTML?
The html file extension of SSI (Server Side Include). SSI (Server Side Include) is usually called "Server-Side embedding" or "Server-Side inclusion ", is a server-based web page creation technology similar to ASP.
SSI Working principle:
Before sending content to a browser, you can use the server-side include (SSI) command to include text, graphics, or application information to a webpage. For example, you can use SSI to include a time/date stamp, a copyright statement, or a form for the customer to fill in and return. For text or graphics that repeatedly appear in multiple files, using include files is a simple method. You can store the content in an contained file without entering the content into all files. You can use a very simple statement to call the inclusion file, which instructs the Web server to insert content into an appropriate webpage. In addition, when a file is included, all changes to the content can be completed in one place.
Because files containing SSI commands require special processing, the SSI file extension must be assigned to all SSI files. The default extensions are. stm,. shtm, And. shtml.
The Web server processes SSI commands while processing webpages. When the Web server encounters an SSI command, it directly inserts the content containing the file into the HTML webpage. If the "include file" contains the SSI command, insert the file at the same time. In addition to the basic commands used to include files, you can also use the SSI command to insert information about files (such as the file size) or run applications or shell commands.
A common problem with website maintenance is that the website structure is fixed, but a large number of webpages have to be redone to update a little content. SSI provides a simple and effective method to solve this problem. It places the basic structure of a website in several simple HTML files (templates ), in the future, all we need to do is to upload text to the server so that the program can automatically generate webpages according to the template, making it easy to manage large websites.
Therefore, the purpose of pages in SHTML format is similar to that of ASP, but it is faster and more efficient because it is an API. It is faster than ASP and slower than HTML. However, because it can be included on the server, therefore, it is easy to update pages (especially batch update banner and copyright). Imagine that you have an HTML section that involves inserting some special server scripts, such as inserting other HTML sections, you choose ASP to complete this task, but if the task is more heavy, need more time, such as 5 s, this time you do not need ASP and use SHTML, maybe the processing time is only 4S.
What is SSI used?
The reason we need to talk about SSI is the acronyms of Shtml-Server-Parsed HTML. Contains HTML text containing commands on the embedded server. Before being sent to a browser, the server will completely read, analyze, and modify the SHTML document. Shtml is similar to asp. Some ssi commands are used in files named after shtml, just like asp commands. You can write ssi commands in the shtml file, when the client accesses these shtml files, the server will read and interpret these SHTML files and explain the SSI commands contained in The SHTML files, for example: you can use the SSI command in the SHTML file to reference other html files (# include). The files sent by the server to the client are interpreted as SHTML without the SSI command. It implements a function not available in HTML, that is, it can implement a dynamic SHTML. It can be said that it is an evolution of HTML. Like Sina's news system, the news content is fixed, but the advertisements and menus on it are referenced by # include.
At present, it mainly has the following usage:
Display Server Environment Variables <# echo>
Insert text content directly into the document <# include>
Display WEB Document Information <# flastmod # fsize> (such as file creation date/size)
Directly execute various programs on the server <# exec> (for example, CGI or other executable programs)
Set SSI information display format <# config> (for example, file creation date/Size Display Mode)
Advanced SSI <XSSI> allows you to set variables to use the if Condition Statement.