Google Answers Logo
View Question
 
Q: incluing a page in another HTML page ( Answered 4 out of 5 stars,   0 Comments )
Question  
Subject: incluing a page in another HTML page
Category: Computers > Internet
Asked by: jhabley-ga
List Price: $2.00
Posted: 12 Oct 2003 13:57 PDT
Expires: 11 Nov 2003 12:57 PST
Question ID: 265516
I have a single-page blog that I would like to have appear on the
front page of my family's web site. I think there is an INCLUDE
command that can do this. I've tried IFRAME but I don't want the HTML
read in (page background, etc) -- plus, clicking links in the IFRAME
loads them into that frame.

I've also tried FrontPage 2002/XP's Include File command, which
results in a <--! webbot > command of some kind, which looks fine in
frontpage but doesn't work when out on the web.

I have PHP if that will help.
Answer  
Subject: Re: incluing a page in another HTML page
Answered By: larre-ga on 12 Oct 2003 17:47 PDT
Rated:4 out of 5 stars
 
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
jhabley-ga rated this answer:4 out of 5 stars
Thanks! The command syntax was what I was mostly after... though the
researcher's solution did not work, it wasn't his/her fault -- likely
server config.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy