What is SSI, or make your website easier!
Internet technology today is becoming more accessible. Anyone can open their site on the Internet, the choice of options – for every taste. You can painstakingly write tags in Notepad, you can use special visual editors, you can simply sketch a page in Microsoft Word and save it in HTML format. In a word, “create, invent, try!”. It is absolutely not necessary to be a professional programmer or designer, more and more often amateurs enter the Internet arena. Almost every unprofessional site begins its existence in the form of several HTML-documents linked by cross-links. Many people leave in this state for informational eternity. But some amateur sites are still becoming popular, overgrown with bold content, and work up volume. Sometimes they grow to tens or even hundreds of pages. But in essence they remain a set of once and for all formed documents. Maintaining and updating such a site is a torment for its owner. A page, as a rule, consists of several blocks, and part of them is unchanged for all pages of the site. This is the title, navigation menu, ad unit, page footer. If you want to change something in one of these permanent blocks, you will have to manually do this on each page of the site. Pleasure is very doubtful. Often, interesting ideas remain unrealized precisely because of the large editing volume of dozens of individual pages. SSI can greatly facilitate this work. In addition, SSI technology allows you to do something else that is fundamentally not feasible using HTML. Using SSI is simple, although knowledge of the HTML language will help a lot. If you are not afraid, then go! mytarget First of all, we will decipher the abbreviation SSI – Server Side Includes. In Russian, “server-side inclusion.” All clear? Then let’s end … Although it would be better to explain all the same. SSIs are directives that are inserted into HTML code and control a web server. Meeting such SSI inserts in a file, the web server performs certain actions. For example, adding HTML code from another file, creating pages on the fly depending on the type of browser, and much more. In order for the server to know that the page contains SSI inserts, it must have a special extension: * .shtml or * .shtm, although this is determined by the server configuration. The most commonly used is * .shtml. The fact that the server supports SSI is usually reported in the description of the hosting or tariff. But check does not hurt. To do this, create two files – first. shtml and second.html. To file first. shtml copy six lines: To the second file. html write only one line: It works! Now upload these pages to the server and write in the address bar of the browser “your_site / first.shtml”. If the server supports SSI, then after opening the file we will see the inscription “Works!”. If it says [an error occurred while processing this directive] instead, congratulations too! SSI works, but it is not possible to handle the SSI insert. For example, you could insert extra spaces in the code or name the files differently. Most likely, the Unix system is working on the server, and for it second. html and Second. html are two big differences. If nothing is displayed at all, and SSI support is declared, then it is easiest to contact technical support. Maybe, instead of the * .shtml extension, something else is used or in the site settings you need to explicitly allow SSI execution. In any case, hosting specialists will try to help you. So, how can SSI help with site maintenance? The main goodies are as follows. Any fragment that is repeated on several pages, we can store on the server in a single copy! To do this, put this fragment in a separate file, for example fragment.html. This file does not need other attributes of a “full-fledged” html-document. There should be only the code fragment itself, which will then be inserted in its place. Now, anywhere on any page of the site where this fragment is needed, we write an SSI insert: The file must be in the same directory as the main file. If you want to move all the insert files to a separate directory, you will have to use another command, which indicates the full path to the fragment file relative to the current directory: Thus, in the main file you can leave only the “skeleton” of the page, for example, a wireframe and the main text , and add all constant blocks through SSI inserts. The full page will be formed by the web server “on the fly”, as if from separate bricks. Nevertheless, the user will receive a full page on the computer, without the slightest sign of using SSI. If you change something in the fragment, it will automatically appear on all pages where it is used. Are you still thinking? Then, specially for you, in the second part of the article we will consider such goodies that there will be no doubt about using SSI.