What is SSI, or make your site easier! (Part 1)

What is SSI, or make your site easier! (Part 1) Internet technology today are becoming more affordable. View your site on the Internet can anyone of choices - for every taste. You can painstakingly write tags in Notepad, you can use special visual editor, you can simply jot down the page in Microsoft Word and save as HTML. In short, "create, invent, try!". It is not necessary to be a professional programmer or designer, increasingly come into the arena of Internet enthusiasts.

Almost every non-professional website begins its existence in the form of several HTML-documents, linked by cross-references. Many of the well and go in this state in the information forever. But some amateur sites yet become popular, overgrown Zhirkov content, fatten volume. Sometimes, they expand up to tens and even hundreds of pages. But in essence are set once and for all generated documents.

Maintain and update this site - torment that exists for its owner. The page usually consists of several blocks, and some of them are the same for all pages. This title, navigation menu, ad unit, the page footer. If something wants to change in one of the permanent units, it will have to manually do at each page. Pleasure is very doubtful. Most interesting ideas remain unrealized precisely because of the large amount of editing dozens of individual pages. SSI can greatly facilitate this work. Additionally, SSI allows you to do something else, fundamentally workable means of HTML. Use SSI easy, though knowledge of HTML very helpful. If you're not scared, then go!
First, decode the abbreviation SSI - Server Side Includes. In Russian, "server-side includes. All clear? Then at the end ... Although it would be better still to explain. SSI - a directive which are inserted in the HTML-code and managing web-server. Meeting in the file such SSI-paste, web-server performs certain actions. For example, adding HTML-code from another file, the formation of pages on the fly, depending on the type of browser and much more.

In order to make the server know that the page contains SSI-insert, it must have a special extension: *. shtml or *. shtm, although this is determined by the configuration server. Most often used is *. shtml. The fact that the server supports SSI, usually reported in the description parked or tariff. But the test does not hurt. This will create two files - first.shtml and second.html. In the file copy first.shtml six lines:

In the file second.html write only one line:


Now load these pages to the server and write in the address bar of your browser "www.vash_sayt/first.shtml». If your server supports SSI, then after opening the file we will see "It works!". If, instead, written 1,111,112. Also congratulations! SSI is working, but the process SSI-insertion is impossible. For example, you could paste into the extra space or a different name files. Most likely, the server is working Unix-system, and for her second.html and Second.html - two big differences.

If you do not see anything at all, and declared support for SSI, then the easiest way to contact technical support. Perhaps, instead of expansion *. shtml used something else or in the website settings, you must explicitly allow execution of SSI. In any event, hosting specialists will try to help you.

So, what SSI can assist in accompanying website? Main goodies is as follows. Any piece that is repeated on multiple pages, we can store on a server in a single copy! To do this, put this piece into a separate file, for example fragment.html. This file is not needed, and other attributes of full »html-document. There should be only the snippet of code which will then be inserted in its place.

Now, anywhere in any page of the site where the fragment will need, we write SSI-box:

The file must be in the same directory as the original file. If you want to make all the files and paste into a separate directory, you'll have to use another command, which indicates the full path to the fragment in relation to the current directory:

Thus, in the main file can leave only a "skeleton" page, such as skeleton table and the main text, and all the permanent blocks to add a SSI-inserted. Full page will form the web-server on the fly, as if from separate blocks. Nevertheless, the user on the computer comes full page, without any signs of SSI. If you change something in the fragment, it automatically appears on all pages where it is used.