Use SSI in construction of a site
In this clause{article} I shall approximately tell about that how practically to use technology SSI.
Naturally it not 100 % a variant, variations are possible{probable}, one of the main tasks - to understand " and what for it is necessary ". It is necessary to take into account:
Whether first of all supports your server technology SSI
That affiliated files are SHTML pages which in turn too are processed on presence SSI.
That " variables of an environment " (" environment variables ") type: DOCUMENT_NAME in affiliated documents shows parental parameters
That variables are passed documents affiliated and following on performance except for - instructions{indications} of mistakes <! - *config errmsg = "[error]"->
That ways to scripts in affiliated documents go concerning affiliated documents
That ways to the schedule at a conclusion go concerning the parental document
The structure of a page looks approximately so:
The parent news.shtml
<html>
<head>
Variables SSI
Name of page <title> the Name of a page </title>
Mehtategi <! - *include virtual = "put`_k_skriptu/mt.shtml"->
Styles <! - *include virtual = "put`_k_skriptu/styles.shtml"->
JavaScript <! - *include virtual = "put`_k_skriptu/js.shtml"->
</head> <body>
Top of a site <! - *include virtual = "put`_k_skriptu/top.shtml"->
The tablet - structure of a site, for an example is broken into 3 parts.
SSI path/left.shtml SSI path/start.shtml SSI path/right.shtml
Bottom of a site <! - *include virtual = "put`_k_skriptu/botom.shtml"->
</body> </html>
It is necessary to take into account:
As the top and a bottom of a site (include virtual) are not in the general{common} table.
So the information on the screen will be faster displayed.
Variables SSI In this part are created variables which used on all site;
One for convenience,
Others for convenient and fast change of design,
tretie for an opportunity of demonstration of navigation and conducting statistics.
Grammar: *set var = *** value = ***
Appropriates{Gives} new value of a variable. For example:
<! - *set var = "SERVER_ADMIN" value = "novyj@adres.ua"->
Variables:
The name of a page - <! - *set var = "NamePage" value = "NEWS"->
The SSI-command - <! - *config errmsg = " [ERROR $NamePage] "-> It is deduced at what that to mistake SSI
URL pages - <! - *set var = "WWW" value = " http: // $HTTP_HOST/km / "-> Usually it is useful for long ways
Color bekgraunda - <! - *set var = "COLORBCG" value = "FAF6EF"-> the Badge * is desirable for not putting
Color zalivki 1 - <! - *set var = "COLORfonA" value = "FBF7EE"->
Color zalivki 2 - <! - *set var = "COLORfonB" value = "D8F3D8"->
Color zalivki 3 - <! - *set var = "COLORfonS" value = "008000"->
Color of credits 1 - <! - *set var = "COLORtitrA" value = "800000"->
Color of credits 2 - <! - *set var = "COLORtitrB" value = "008000"->
Color of credits 3 - <! - *set var = "COLORtitrS" value = "404040"->
Having replaced one of parameters of "color" at you his{its} value in all affiliated documents will exchange
For the greater presentation we shall transfer our variables on some pages that at each page the style was.
On the parent we leave: the SSI-command of a mistake and URL pages, but it after such script
<! - *if expr = " $ QUERY_STRING =/ssi / "->
<! - *include virtual = "path/varssi.shtml"->
<! - *elifexpr = " $ QUERY_STRING =/new / "->
<! - *include virtual = "path/varnew.shtml"->
<! - *else->
<! - *include virtual = "path/var.shtml"->
<! - *endif->
...
<! - *config errmsg = " [ERROR $NamePage] "->
<! - *set var = "WWW" value = " http: // $HTTP_HOST / "->
In each of files: varssi.shtml, varnew.shtml and var.shtml variable "colors" with various parameters are entered
As it works: If in line after the name of a file there will be a part of a word with symbols "ssi" that schityvatsja there will be a page varssi.shtml with the parameters of "color"
Accordingly at symbols "new" a page - varnew.shtml. If anything similar is not - that a page var.shtml.
Those variables which should be different for different pages - to enter in files var ***.shtml, and those which time and on always in var.shtml better
The name of page is Easier to write <title> the Name of a page </title>
But it is possible and so <title> <! - *echo var = "NamePage"-> </title>
Variable NamePage will be used still many times, therefore having changed a variable in installations " set var = " she varies automatically everywhere.
Mehtategi Having created once a page mt.shtml with all metatags you get rid of their spelling for each page, and also their editing in each page separately.
It is necessary to take into account that you write to a page only metatags without <html> <head> </body> </html> for example:
<meta http-equiv = "Content-Type" content = " text/html; charset=windows-1251 ">
The some people at once will be indignant that mine FrontPage peregeneriruet (will create anew) all pages with my changes. Yes but after that to you gently to begin to rock all pages on the server and if them 200, and having begun to rock you have understood what not all have added or what not so, and that all all over again. And here one page have changed and for all it is identical.
Now others will be indignant, that does not happen so at all pages identical metatags should be. Yes I shall agree, that some pages should have others mehtategi. As it to solve - for example:
Contents of a forum are not necessary kehshirovat`:
<META HTTP-EQUIV = "Pragma" CONTENT = "no-cache">
<! - *else->
<META HTTP-EQUIV = "Cache-Control" CONTENT = "Public">
<! - *endif->
As it works: If in a name of a file there will be a line "forum" the line with parameter "no-cache" will be entered, for all others a line with parameter "Public".
Styles As well as in the previous variant the file styles.shtml without html, head, body is created.
Inside can be:
The simple link - <link rel = "stylesheet" type = "text/css" href = "kms.css">
Or a choice depending on a browser
<! - *ifexpr = " $ HTTP_USER_AGENT =/MSIE/|| $HTTP_USER_AGENT =/Microsoft / "->
<link rel = "stylesheet" type = "text/css" href = "kmsi.css">
<! - *elifexpr = " $ HTTP_USER_AGENT =/Opera / "->
<link rel = "stylesheet" type = "text/css" href = "kmso.css"> <BR> <! - *elifexpr = " $ HTTP_USER_AGENT =/Mozilla / "->
<link rel = "stylesheet" type = "text/css" href = "kmsn.css">
<! - *else->
<STYLE type=text/css>
P {FONT-FAMILY: tahoma, verdana, arial, helvetica; FONT-SIZE: 12px}
TD {FONT-FAMILY: verdana, arial, helvetica; FONT-SIZE: 12px}
A {TEXT-DECORATION: none; color: "black"}
A:hover {TEXT-DECORATION: none; COLOR: *800040;}
INPUT {font-family: Tahoma; color:black; font-size=13px;}
</STYLE>
<! - *endif->
As it works: Depending on that that is in a variable (" environment variables ") $HTTP_USER_AGENT what type of a browser at you and that part which corresponds{meets} to a browser is deduced from the server to you only. Well and if the browser not opredijaetsja that is deduced opredilennyj a set of style that after a line <! - *else->.
All this certainly in the size in bajty, but is necessary to take into account what is it all is in a separate file styles.shtml which easily to edit and works for all pages of a site.
JavaScript As well as in the previous variants the file js.shtml without html, head, body is created.
Inside can be:
The simple link - <SCRIPT language=JavaScript src = "/win_open.js "> </SCRIPT>
Or a choice depending on page
<! - *if expr = " $ DOCUMENT_NAME! =/forum / "->
<SCRIPT language=JavaScript src = "../js/win_open.js"> </SCRIPT>
<! - *endif->
That is the script will be present on all pages except for those in which at a name there will be a word forum
The top of a site As well as in the previous variants is created a file top.shtml without html, head, body.
Inside there can be a whole complex of the design decision, therefore we shall be limited to the big name and a conclusion banera:
<FONT color = " * <! - *echo var = "COLORtitrA"-> " style = " font-size: 22px; text-align: center; "> <! - *echo var = "NamePage"-> </FONT>
That is on a place color () it will be entered variable COLORtitrA which we have defined{determined} color of a font in a parental file news.shtml and var.shtml in the same place and variable NamePage with the name of page.
Let's return back to a file top.shtml, and we shall draw a conclusion banera
<! - *include virtual = "path/baners.shtml"->
It a miracle as often you change banerhhikov for example on an exchange, bad CTR - change. Naturally in one file - baners.shtml
Want the banernuju system - please:
<! - *include virtual = "../cgi-bin/ranban.cgi"->
It is possible that but` and on more complex{difficult}
<! - *config timefmt = " % H "->
<! - *if expr = " DATE_LOCAL> 9 "->
<script language = "JavaScript" src = " http: // www.baners.com/ban.cgi "> </script>
<! - *else->
<! - *include virtual = "/cgi-bin/ranban.cgi "->
<! - *endif->
That is it is understandable after 9 o'clock in the afternoon it is shown banera from a site on JavaScript, and from 0 o'clock the vnutrenij a script " randomajze show "
HTML Tables
<table width = " 90 % " border = "1" cellspacing = "0" cellpadding = "0" align = "center">
<TR> <TD>
<! - *include virtual = "path/left.shtml"->
</TD>
<TD>
<! - *include virtual = "path/start.shtml"->
</TD>
<TD>
<! - *include virtual = "path/right.shtml"->
</TD> </TR>
</table>
left.shtml
The left part of a site here we deduce{remove} the tablet, with links on all site. On a page the prepared variables of colors and that important full address of links from variable WWW are used
Color bekgraunda - COLORBCG
Color zalivki 1 - COLORfonA
Color zalivki 1 - COLORfonB
Color of credits 1 - COLORtitrA
Color of credits 2 - COLORtitrB
<table border = "0" cellpadding = "0" cellspacing = "0" width = "120" align = "center">
<tr> <td color = " <! - *echo var = "COLORfonA"-> ">
<a href = " <! - *echo var = "WWW"->/news.shtml ">
<FONT color = " <! - *echo var = "COLORtitrB"-> "> news </FONT> </a> </td> </tr>
</table>
And in the end your set of counters will not prevent SSI a link on a page left_baner.shtml, in which.
<! - *include virtual = "left_baner.shtml"->
start.shtml
Here there can be a big set of scripts but we shall be limited novostijnymi to conclusions with variations.
By default will start a script novostijnykh titles, and by pressing the title you get on a conclusion novostijnogo the block or concrete old news
<! - *ifexpr = " $ QUERY_STRING =/new / "->
<! - *include virtual = " path/news.cgi? $QUERY_STRING*COLORfonA = $ COLORfonA*COLORtitrA = $ COLORtitrA "->
<! - *elifexpr = " $ QUERY_STRING =/old / "->
<! - *include virtual = " path/old_news.cgi? $QUERY_STRING "->
<! - *else->
<! - *include virtual = " path/zaglavie_news.cgi? $QUERY_STRING "->
<! - *endif->
In the first "inkljude" if you have noticed we pass our variable SSI environments in CGI environment, that is our color variables are passed in CGI a script.
Here just it is important that in a variable there was no sign * and that will turn out nothing
right.shtml
Here too there can be a big set of scripts, the menu, links depending on various " variables of an environment " (" environment variables ").
For example HTTP_COOKIE
<! - *ifexpr = " $ HTTP_COOKIE =/Administrator / "->
<! - *include virtual = " path/admin.cgi? $QUERY_STRING*COLORfonA = $ COLORfonA*COLORtitrA = $ COLORtitrA "->
<! - *endif->
That is in this case only personally at you will be the script admin.cgi with ample opportunities on administration of a page is deduced.
And only on that that at you in COOKIE sacred word Administrator is registered
Though you understand that for such cases better, something such as such kmWmtfSWNlFnLM
How to code and write down in COOKIES such password, it is conversation not for this subject
The bottom of a site As well as in the previous variants is created a file botom.shtml without html, head, body.
Inside there can be tags of copyrights, banerov, elements of the statistics of type:
<! - *includevirtual = " stat.cgi? file = $ DOCUMENT_NAME*name = $ NamePage and $ QUERY_STRING "->
Good advice{council}:
Do not overlook to finish in affiliated files the SSI-command-
<! - *config errmsg = " [ERROR $NamePage] "->
And that the inscription " [an error occurred while processing this directive] " very much is not beautiful
I would wish that at you never appeared such inscriptions!
That's all.

|