Solved

'Including' an HTML document

Posted on 1998-08-06
2
531 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.net Markup for Sub Menu 2 45
how to customize the text in the legend in highcharts 3 35
Two decimal 5 29
Table header must be on top 2 30
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

733 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