| |
Server-side includes (SSI) are partway between static HTML files
and CGI scripts. A server-side include file looks like HTML;
and, in fact, it is. But it also contains some directives
inside comments. When the Web server displays the file, it
first finds the special directives and acts on them, then
displays the resulting file to the browser. It's not nearly
as powerful as CGI, but it's not nearly as difficult.
There is no security risk, so there is no limitation on
which browser can connect to your SSI files.
|
|
| |
SSI is mostly good for dynamic includes. For example, suppose you
have a dozen related HTML files, and you want to have a common
navigation bar at the bottom of each file. Four ways to do this:
- Just copy the navigation bar into each HTML file.
This works, but is a pain to change later.
- Write a small program to combine each HTML file with
the navigation bar, and write out the resulting HTML file.
This works, and is most efficient with machine resources.
But you have to write the program, and have to remember to run it.
- Write a CGI script, and deliver all HTML and navigation bars
programatically. Works, but overkill for something like this.
You have to write the program; debug it; and, even so, people
outside UIC can't see the results.
- Use SSI. Easy to do, no programming, no limitations.
SSI mostly lets you include one file inside another. There are
a few other directives; you can display the date a given file
was last changed, for example. And new versions of the Web server
will include some rudimentary conditionals, so that you could
display one version of your page to MSIE and another version to Netscape.
(This will have to await a server upgrade, though).
But if this is all you need, SSI fills the bill.
|
|
| |
The main reason not to use SSI is server load. If too many people
do this frivolously, we may not have enough server capacity to go around.
Remember that for each SSI file, the Web server has to read every
line of the file, searching for SSI directives. So use SSI if
you have a reasonable need, but don't use it just to be cool.
|
|