?
Solved

'Including' an HTML document

Posted on 1998-08-06
2
Medium Priority
?
542 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
jbirk earned 150 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

752 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