Do you have a question? Post it now! No Registration Necessary. Now with pictures!
November 29, 2006, 6:20 am
rate this thread
There are two basic approaches, neither of which is HTML.
One is server-side includes (SSI). You have to know some details of your
server configuration to use SSI. SSI must be turned on in the server, which
is pretty standard with most hosts, but it is possible that it isn't on
yours. You must know how to indicate which documents have includes. The
two principal ways are with the file extension (mydocument.shtml instead of
mydocument.html) or the Xbithack, which means setting the executable bit on
the document. You will have to research your particular brand of server and
examine or ask about the server configuration.
In the main document an include for a document served by Apache looks
<!--#include virtual="filename.txt" -->
To HTML this looks like a comment and is ignored, but when properly served,
the contents of filename.txt are inserted in the document at this point in
a way that looks seamless to the viewer (browser, user agent). The
inserted file should not be a complete HTML document, but instead is the
snip of markup you want to include at this point.
When you change filename.txt, the changes will appear in every document that
The main drawback is that to see the document as served, you have to have a
server. If you view the document as a file, the includes will be missing.
This may be a good thing if you have many text-heavy documents and want to
concentrate on proofing the text without the distraction of the included
boilerplate. It is a good idea to make the included file a complete block of
markup, so you have a valid document even when the included part is missing.
The other main approach is to use a preprocessor. This approach is a little
too complex to go into here, but basically you have the choice of using a
preprocessor on a server, which is not a whole lot different from SSI,
or of using a preprocessor to produce documents before you put them on the
server. PHP is widely (but not universally) supported by servers. It can
also be used to produce complete documents before you upload them to a
server, in which case there doesn't have to be anything special about the
server. There are a wide variety of scripting and report languages and
preprocessors (many of which are intended for programming) in which it is a
relatively simple matter to insert a block of text into many documents, and
controlling a number of such processes can be done with a Make utility,
whichever flavor your system may support.
Okay, which way to go?
If you are using Frontpage I'd guess you don't know much HTML and are pretty
much at sea concerning what you are doing. You probably should start with
SSI if it available on your server. You will have learn HTML and how to use
a flat ASCII editor on your documents (but you will have to learn that much
for any solution). You might start just by using cut-and-paste to paste
the appropriate markup into several documents, and when you know what you
are doing, then let SSI do the pasting for you. If your site never gets
very elaborate, this may be all you need.
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner
War on Terrorism: Treat Readers like Mushrooms
"DO NOT USE photos on Page 1A showing civilian casualties from the U.S. war
on Afghanistan." -Memo, _Panama City_ (FL) _News Herald_