Forum Moderators: open

Message Too Old, No Replies

How to include a HTML page to another HTML Page

         

Rachna

11:11 pm on Feb 24, 2005 (gmt 0)

10+ Year Member



Hi,

I'm in a process to creating a website.
I have header i.e a menu bar which is common for all the pages . So I want to call the HTML page (which has got the menu bar ) in all the pages .
Is there any sytax to include the HTML files.If so how to do it?
Please help?

tedster

11:40 pm on Feb 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Rachna, and welcome to the forums.

One common approach is what's called Server Side Includes, or SSI. The language PHP also s another approach for includes.

These approaches are all server side, and require that your website's server is enabled for that technology, but such service is common these days.

A Google Search [google.com] limited to this very forum will give you about 300 results you can learn from about SSI.

billythekiddo

11:46 pm on Feb 24, 2005 (gmt 0)

10+ Year Member



If you are allowed to run ASP:

On the top of the page:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

Somewhere in the page:
<!--#include file="file.asp" -->

With only HTML it is not possible 8-)

Rachna

11:55 pm on Feb 24, 2005 (gmt 0)

10+ Year Member



Thanks for the info.
Now Am creating the website in MSfrontpage .
So can I use IIS instead of SSI and PHP.

tedster

12:18 am on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



FrontPage also has an include feature. The software then generates the entire page before you upload rather than asking the server to do it - but you still only need to modify one file whenever you make a change.

Asif

12:52 am on Feb 25, 2005 (gmt 0)

10+ Year Member



It's possible in JSP and ASP, and impossible in HTML alone. However, I'm not sure about Frontpage.

blaze_125

7:05 pm on Mar 1, 2005 (gmt 0)

10+ Year Member



Of course it's possible.

Instead of naming your files as .htm or .html, name them as .shtml

Put the following line where you want the include to appear:

<!--#include file="blablabla.shtml" -->

So you .shtml would look like this:

<html>
<head><title></title>
</head>
<body>

blablabla, blablabla, blablabla, blablabla

<!--Now you want information from xyz.shtml to appear so you put in-->

<!--#include file="xyz.shtml" -->

</body>
</html>

blaze_125

7:09 pm on Mar 1, 2005 (gmt 0)

10+ Year Member



When you enter the tag
<!--#include file="blablabla.shtml" -->

Make sure YOU DO type in the comment marks. Enter the tag as shown and it will work. You won't be able to see it working while the page is hosted on your personnal computer(unless you have IIS installed and configured accordingly), but it will work as soon as you upload your pages on your webserver.

ronin

8:34 pm on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's a wonder that the w3c haven't come up with a way of including code in an xhtml document without using shtml.

If you upload an external javascript, css or image file on your webspace you can reference that single file on an unlimited number of webpages.

But you can't do the same with code.

I wonder if there will ever be a way to have:

<code type="text/xhtml" src="/navlinks.html"></code>

in a normal xhtml document?

Milamber

2:24 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



Rachna said:
Now Am creating the website in MSfrontpage .
So can I use IIS instead of SSI and PHP.

Does this mean that you were using PHP before? If thats the case and you're more familiar with php, you can use a php include:

<?php require("header.htm");?>