SSI Basic Tutorial

By

Aleck



First of all make sure your host supports SSI, usually they do, but make sure, it never hurts. Next thing, SSI stands for Server Side Includes, very important to understand 'Server Side' - surfers will never notice that you have SSI-powered pages (btw SE spiders will not notice that either)

How does SSi work? You insert SSI commands into your html file, just simple text command, we will cover 'em later, and server software will parse it (please note that some hosting companies are configuring their server software to pass only some special extensions, usual .shtml - that's faster, 'cuz plain .html's are not parsed, but is better only at high traffic sites) and send _ready_ page to surfer

What we can do with SSI? Rather a lot.

First of all we can run cgi scripts inside our page, that's awesome feature for counters, pictures of the days, even recip tables.

Usually exec feature is used <!--#exec cmd="/cgi-bin/somefolder/somescript.cgi" -->, but I strongly recommend to use virtual SSI command instead: <!--#include virtual="/cgi-bin/somefolder/some script.cgi?someparameter=somevalue" --> 'cuz we can send parameters to our scripts and that rocks, trust me :=) I have all AVS scripts called by virtual directive, when AVS is changing script it takes me 20 seconds to make changes on hundreds pages :)

We can insert external files - very easy to use and nice feature <!--#include file="/somefolder/somefile.txt" -->. Great for putting recip tables, SE interlinking, navigation bars, etc. This feature is working extremely fast, so you can use it rather often without slowing your server a lot

We will not dig deep in SSI, but browser specific content generation using extended SSI is my weakness.

As we know all browsers are a bit different, some features are unique for IE, some for Netscape and using eSSI we/can always be sure that surfer has the best possible variant for his browser.

Why is it better than using javascript? Well, first of all, 10% of surfers has javascript disabled and your browser specific javascript code will be useless. Second, pages generated by eSSI for particular browser are always smaller, you can save a lot of bandwidth, really a lot if you have loads of html, not graphics surely.

I hope it's very clear, we are checking ${HTTP_USER_AGENT} (the variable that server is giving us filling with browser type) comparing with WebTV, then MSIE and finally Mozilla (note that MSIE also has Mozilla in description, so we are checking it for Netscape). After that we can use $browser variable as we like, for example:

Some text goes here, it will be marquee in IE, blink in Netscape and bold in any other browser

As you can see it's rather simple and will be always sure that your page is smallest possible and working for that browser, but note that pages with high traffic and a number of SSI instructions can slow down your server (CPUs are getting more powerful each month, but don't forget about this anyway)

SSI is rather powerful thing, after this tutorial we will go deeper, try all this features on your host, don't forget "ppl should think and computers - work", let 'em work for you

Oh yeah, just imagine that you have loads of AOL surfers and two pay-per-click sponsors - one for uniques and one for raws. You can send AOL surfer as raw (usually they all come from a group of AOL proxies) and others as uniques, this will increase your revenues a lot. hehe, just an example what you can do with SSI :)

Enjoy! We are in XXI century, use hi-tech to gain more $$$ :-)

Good Luck,
Aleck

 
"Opportunity may knock only once, but temptation leans on the doorbell."
Anon.
 

©2001 VNWR. All rights reserved.