Solved

'Including' an HTML document

Posted on 1998-08-06
2
528 Views
Last Modified: 2013-11-18
I was wondering if it is possible to insert a web page inside another page.  Such as:

File:  MyFooter.htm
HTML:
<HTML>
<HEAD>
<TITLE>None</TITLE>
</HEAD>
<BODY>
Copyright (c) 1998 - Egore
</BODY>
</HTML>

File:  MyHTML.htm
HTML:
<HTML>
<HEAD>
<TITLE>None</TITLE>
</HEAD>
<BODY>
Thank you for visiting this page!<BR>
<BR>
#include "MyFooter.htm";
</BODY>
</HTML>

In the above example, you have two HTML files, one of which 'includes' the other one inside it's body.  Is this possible to do and, if so, how do you do it?

(If you didn't notice, I used a 'C Language' command to include the file in the other file.  This (of course) does not work in HTML...)
0
Comment
Question by:Egore
2 Comments
 
LVL 8

Accepted Solution

by:
jbirk earned 50 total points
ID: 1845100
Yes, it is possible.  Except if you were to include MyFooter.htm, it would have an error since the document would read:
<BR>
<HTML> //include start here
<HEAD>
<TITLE>None</TITLE>
</HEAD>
<BODY>
Copyright (c) 1998 - Egore
</BODY>
</HTML>  //include ends here
</BODY>
</HTML>

And that would be a problem.
To include html files you need a server ability called server side includes (SSI).  This is a really nice feature and makes other things counters work well and maintaining a large site with similar headers and footers easy to do.
So you first need to find out if you service provider allows server side includes.

Then the statement to include a file like this would look like this:
<!--#include virtual="../common/leftlinks.shtml"-->

Another thing about server side includes, is that very often servers that do support them require that any file must have a ".shtml" or ".shtm" extension or whatever the server prefers in order for the file to have an include.  This is so that service would not be slowed down by the server reading in every single file before sending it out.  It will only read in the files which could possibly contain a SSI.

Hope this can work for you!  It's a nice feature if it does.
-Josh
0
 
LVL 28

Expert Comment

by:sybe
ID: 1845101
There are 2 different include statements:

<!--#include file="relative_path/file.txt"-->

<!--#include virtual="/complete_path/file.txt"-->

The difference is that for the first you have to give a relative path to the current document, the second starts from the root of the server.


0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Could you point how to give Bootstrap's open/ close menu effect ? 25 53
send keys not working in vba 7 60
Border and image sizing 5 20
Call a function within the ASP code 4 12
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question