Thanks for asking!
The simple Server Side Include (SSI) coding is:
<!--#include virtual="path/yourfile.txt" -->
You may use either a text (.txt) or HTML (.htm or .html) file
extension for the file you wish to include. You may use either a
relative path (i.e. related to your document, such as
/docs/filename.txt ) or an absolute path (related to your site, i.e.
http://www.yoursite/sub/include-filename.txt) in your statement.
In your Include file:
-- Do not use a <HEAD> section or tags
-- Leave out <BODY> and </BODY> tags.
CSS styles are placed at the beginning of the included document, or,
you can add them to your master style sheet.
Especially important:
-- Be sure to show the correct path from your blog page to your
Included file in the Include tag.
-- Remember to upload the file(s)to be Included to the correct
directory of your webspace.
-- Rename your master document with an .shtml file extension before
uploading.
----------------------------------------------------------------------
For additional information and coding examples, I recommend the
following tutorial from Able Design, and the more global tutorials
from Big Nose Bird:
------------------------
Simplified SSI Tutorials
------------------------
Server Side Includes
http://abledesign.com/tutorials/ssi.php
---------------------
General SSI Tutorials
---------------------
Big Nose Bird
http://www.bignosebird.com/ssi.shtml
----------------------------------------------------------------------
SSI is a marvelous time saver. Once you learn the method, I'm sure
you'll find many uses for it.
Best regards,
larre-ga
Answer Strategy:
----------------------------------------------------------------------
Personal knowledge and
Google Search Terms:
ssi tutorial
server side include |
Request for Answer Clarification by
jhabley-ga
on
13 Oct 2003 10:49 PDT
Hi Larre,
Thanks for this. I'm getting an error. When I try to load the two
affected pages in my IE6.0 browser, I get
[an error occurred while processing this directive]
To confirm, I have:
1. Renamed the main page index.shtml
2. Added the include virtual code and replaced your example text with
the right path to my own page (blog.htm)
3. Taken the html, head, and body tags out of the code of the included
file.
|
Clarification of Answer by
larre-ga
on
13 Oct 2003 11:09 PDT
Okay...
It seems as if you've added the code correctly. The next
troubleshooting step would be to verify that your webhost allows SSI,
and check their FAQ or Customer Support documents to see if there are
any special instructions for its use. In some cases, it's as simple as
requesting that SSI be enabled.
Alternatively, you can post the full URL of your master page (the new
index.shtml) and I will see what information is available.
---larre
|
Request for Answer Clarification by
jhabley-ga
on
13 Oct 2003 11:13 PDT
Hi Larre,
Thanks for your quick reply. I'll check with my server folks -- in the
meantime, I'd love to take you up on your offer to check the page to
make sure I did it right. But I'd rather not publicly post the page
URL. Is there a way I can send it just to you?
|
Request for Answer Clarification by
jhabley-ga
on
13 Oct 2003 12:01 PDT
Just to clarify, SSI is enabled on my server. I just got this reply
from my hosting provider:
"SSI are enabled globally on the server. Please make sure you name SSI
files .shtml"
|
Request for Answer Clarification by
jhabley-ga
on
13 Oct 2003 12:07 PDT
Hi - I think I've found the problem. You wrote:
"You may use either a relative path (i.e. related to your document,
such as
/docs/filename.txt ) or an absolute path (related to your site, i.e.
http://www.yoursite/sub/include-filename.txt) in your statement."
When I followed your direction and used an absolute path, I got the
error message. When I simply type in the filename, it works. Do
absolute paths not work in fact?
|
Clarification of Answer by
larre-ga
on
13 Oct 2003 13:47 PDT
The Google Answers Terms of Service do not provide for direct contact
between Customers and Researchers outside the forum. I can understand
your reluctance to post so publicly, as well. You may upload a .txt
file with the page URL or a copy of the HTML at:
http://66.84.9.229/gaup.html. I will reply here after examination.
---l
|
Clarification of Answer by
larre-ga
on
13 Oct 2003 13:49 PDT
An absolute path *should* work, but it will depend upon the
configuration of the server. A relative path, especially when both
files are in the same directory, is fine.
---l
|
Request for Answer Clarification by
jhabley-ga
on
15 Oct 2003 17:03 PDT
I haven't yet been able to do this:
<!--#include virtual="http://www.server.com/anotherfile.htm" -->
Is this possible? i.e. including a file from another web server?
|
Clarification of Answer by
larre-ga
on
15 Oct 2003 17:48 PDT
Yes, it's possible to use SSI (and the syntax that you've used as an
example) to display a file from a different web server --if-- that
server allows its files to be displayed off-server. Some servers
restrict that type of bandwidth useage. You'd need to check the
server's Terms of Service.
---l
|