| Server Side
Includes (SSI) Do you have some content that is on
every page - or at least on a lot of pages? You may want
to try using some Server Side Includes (SSI). The advantage of using
SSIs is that you can change multiple pages by changing only one
file which is then included on multiple pages. A Server Side Include (SSI)
is a code that tells the server to pull a piece of programming
code, text file, graphic or other item into a webpage just
before it is sent to the Web browser. Many people use SSI to
pre-program headers, footers, or menus. I use SSI on my
website to create the sidebar menu you see at the left. My
pages are set up in tables, of which the left column includes my
menus. All of the information in the dark blue area is put
there by an SSI script. The menu information is actually
in a text file (toc.txt) which resides on my website. Each
time a webpage is pulled up, the server inserts the contents of
the text file where I specified. When I want to change my
menu, I update the text file. Since the webpages display
whatever is currently in the text file, all the menus on my site
are updated automatically when I update the one text file. You
can use SSI to include other types of files (.htm, documents,
graphics, etc), but it is most commonly used to include text
files. So how do you use SSI? You create a file that
you want to include elsewhere. Then you go to the place in your
HTML code you want to include a file and paste the following
into it::
(where the
toc.txt file is the name of the file you want to include)
The above SSI code as shown only works if the toc.txt file is at
the exact same level as the page you're coding. If you have
sub-directories, as I do, you will need to change the coding
just a little to move up a level (or two depending on how deep
your folders go). This creates a "virtual" link. For instance,
when my pages are down one level, the coding changes to:
For additional levels, you add an ../ for each level.
That's all there is to it.
Now, since this is SERVER include, you won't see the actual
contents of the text file in your design program while you're
designing it. But once you upload it, the txt file fills in when
the webpage is displayed. Also, when using SSI, visitors
can't tell it's used when they View-Source on your webpage. It
just loads the txt info right into the page when displayed.
For instance, you can see the results of my SSI at left, but
here's what the HTML code looks like:

And if you do a View-Source on this page, you'll actually see
the entire contents of the text file as if it was programmed
that way! Elsi has several good SSI tutorials, so check them
out below as well as other SSI links listed.
|