WebWord.com > Reports > Server Side Includes (23-June-99) |
by John S.
Rhodes I'm not a Server Side Includes (SSI) wizard. In fact, I have a lot to learn. Fortunately for both of us, SSI are not that complicated. Before I get into the thick of the report, let me throw you a definition of sorts. SSI are basically a way for you to dynamically add information to your web pages without directly using HTML code. In effect, they give you robust control over your HTML components. So, you can call in information from another source (usually a file with some generic text or HTML coding in it). When the web page is requested, the server reads the HTML file and looks for instructions to perform certain actions (i.e., calling in the extra information you want to include). Then, the page is displayed using normal HTML with the information that the server has been directed to include. If my definition isn't clear, you'll need to run through a tutorial before you are able to benefit from this report. As I said, SSI are not that complicated, but having a clear definition in mind is important for this report. If you need an introduction, I suggest that you try one of these sources, then head on back to this WebWord.com report:
In the Link Exchange Digest #613, Dr. Mani Sivasubramanian asked six excellent questions about server side includes. Dr. Mani was kind enough to share several reader responses with me.
Ivan S. Manida of aGSM.net summed up the biggest problem this way:
Other folks had similar things to say about the downsides of SSI. Michael Ludwick states that CPU/resources can take a hit, but that this only really applies to big sites (several million page views per day). However, badly designed SSI can really be a problem on even the best systems. Deacon B. of GenerousNet states that there are some security issues with using the SSI "exec" function (but they are no greater than using CGI). Deacon also reminds us that SSI take more CPU cycles, however, CPU cycles are almost free (it's the bandwidth that costs you). Overall, the advantages outweigh the costs. As Ivan Manida says you can include any system command result via SSI: date, filesizes, modification times, and so forth. You can configure all kinds of things. In short, you have the power to add information to your pages in a simple, dynamic manner.
Note: The assumption of this question is that to use SSI you must use the .shtml extension, which is not true. In any event, no person really thinks that the .shtml is really the cause of problems or user confusions. The .shtml does not make much difference to web users. However, it might cause other problems, particularly for web developers. For example, if you have all .html files, then if you decide to rename your files to use the .shtml extension, you could really mess up your users' bookmarks and various links to your site. However, I'd like to tell you what Jill Metcalfe had to say about this issue:
The bottom line is that you can use a simple and elegant workaround to the .shtml file configuration. Your site can benefit from SSI and your users don't suffer. You can also prevent your site from serving up broken links.
Ivan S. Manida of aGSM.net says that as far as he knows this action is completely transparent to the browser. The server includes the text file before the browser sees the include command (at least with Internet Explorer 2.0 and Netscape Navigator 2.0 and above). Bottom line: I did not find any other good information about this. However, from my understanding of SSI, this should not be a concern for the major browsers. Feel free to send me any problems you have seen using .shtml and SSI with browsers. Steven Champeon of Hesketh.com wanted me to stress the following point:
Here's what Jim Foley, The Information Wizard, had to say:
Ivan S. Manida of aGSM.net says that virtually any information can be used:
Finally, Jill Metcalfe rounds things out. She claims that you don't need any <body> or <head> tags in your imported file, just the html you need for your segment. In fact, some browsers might get confused if they find more than one set of <body> tags in one page. Have a look at the source of one of her SSI footers if you'd like to see that you can pull in what you need without the <HTML> or <body> tags. Further, as a result, the imported segment will inherit any CSS or other instructions given in the head or body of the page into which it is imported. Things end up being transparent. Deacon B. of GenerousNet says you usually do not want to import extra <HTML> and <body> tags, or some browsers will choke. (I assume that this is because you'll have double entries of <html> in the to-be-displayed file).
Here's Ivan's answer to this one:
Jill Metcalfe says that there's a danger that they might, unless you put all your SSI segments into a separate directory and exclude that directory specifically in your robots.txt file, thus: User-agent: * Disallow: /ssi/ Finally, Steven Champeon of Hesketh.com had this to say:
SSIs are parsed on the server and have nothing to do with browsers, and that, according to Steve, is the key.
I'm told that you won't be able to view the page unless your upload them to your site. I suppose you could also set up a dummy HTTP server to try this out, but you might as well just test using the upload method. Michael Ludwick says:
Michael also says that he would only use the
SSI for dynamic data that changed several times a day (or perhaps several times a minute).
Anything else could easily be done through cron/perl and save CPU cycles
(i.e., computing resources).
From what I read, you need to be sure that you are careful about your code and syntax. Things need to be written just right.
Neil Kohl of ACP-ASIM Online (American College of Physicians-American Society of Internal Medicine) recommends the following two books:
Neil also states that Webmonkey has an article on using Apache's SSIs (which were developed by people at Webmonkey who are also working on the Apache project).
Malcolm O'Keeffe wrote me to say that Dreamweaver can display SSI files in its visual editing mode, which is great because it saves you the effort of uploading your files to a web server, switching to a browser, and hitting reload each time you make a change. Dreamweaver also supports and can display XSSI information by using an extension written by the folks at Webmonkey.
That's about all I have to say on the matter of SSI for now. If you have questions or comments, throw them at me <john@webword.com>. |
Now, what should you do?
If you want usability news, tips and tricks, or if you want to know when new reports go online, subscribe to the WebWord.com Usability Newsletter!
Home | Moving WebWord | Cool Books |
Hot Web Sites | Reports
Newsletter Archive | Services | Interviews
| News | About
WebWord.com
Subscribe
to Webword.com |
Contact John S. Rhodes, the WebWord.com Editor and Webmaster
URL: http://www.WebWord.com/reports/ssi.html
© 1999 by John S. Rhodes. All rights reserved.