Discussion Locked

Include a htm page in another htm page

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
The Frontpage Include component can be used to include a common htm page (e.g. header) inside another htm page. This only works if the included component is in the same Front Page Web. Is there a way a htm page be embedded inside another htm page whatever the URL ?

11 replies

by alterego2

You could use a javascript 'client-side' include.

Make sure that the include file has a .js extension. The src can be point anywhere.

Hope that does it.

by jay eckles

The suggestion to use SCRIPT for this purpose is a very poor hack. I suggest you use IFRAME or OBJECT, which are the correct elements for embedding objects (including other HTML pages) within an HTML page. An example of IFRAME might be

OBJECT is very similar...an example for it might be

A good place to go for information about HTML 4.0 is http://www.htmlhelp.com/reference/html40/.

Good luck.

Jay Eckles
www.jayeckles.com

by shanghai sam

Thanks for the answer. I tried both methods and they both work but both open a seperate window/frame and any hyperlinks in the new frame are displayed in the new frame not the main frame if you get my meaning. Anyway to avoid this or to redirect thelinks back to the main frame ?

by alterego2

Can you go into a bit more detail about your page structure and links and end purpose etc.

p.s Poor Hack. lol. Netscape doesn't like IFRAME. Secondly IFRAMES can be a bit of a pain in terms of formatting. Objects.. ah whats the point for a bit ofincluded html..

by aweston2

I have a number of different webs on a server and want to use a common htm header and footer on all webs. The headers have navigation buttons etc. At present I use the include component (webbot)in Frontpage to reference a common htm file e.g. header.htm for each page I create e.g. . The problem is you can't reference an include file outside it's own web so I have to update the file in each of webs everytime I make a change. I would like a common header.htm for all webs but can't find an easy way to do it ? I tried frames and objects and that just confused things as the links in the header where then displayed in that frame etc. Hope this helps explain things ? Any help greatly appreciated. Alan.

by jay eckles

First of all, to the previous poster, you can't put a FRAME element in a document that has a BODY element. A FRAME must be contained within a FRAMESET, and BODY and FRAMESET are mutually exclusive. Just to see if it would work, I tested your code and as I suspected I couldn't get it to work. I think you're probably thinking about IFRAME which can go inside BODY.

Now, to aweston2: I think what you're looking for is SSI (Server Side Include). That would be the "standard" way of doing what your "webbot" does. I put standard in quotes because there's no W3C standard for SSI, but it is commonly implemented by web servers. If you're using Apache, IIS, or any one of several other servers, you can configure SSI. You'll need to check yourserver documentation for how to enable the feature. For a tutorial on how to write SSI directives, try this link:
http://www.wdvl.com/Authoring/Tools/Tutorial/ssi2.html

Please note that there are security concerns with SSI; while it's a useful tool, like any server-side processing you should be wise in how you use it. If you're not the system administrator, you might want to ask the admin about using SSI.

Another solution to what you're trying to do is a template system. There are commercial applications like Teamsite that make management of templates very easy, and I'm sure there are some open-source systems available as well. You should look into them if you have a large collection of templates and websites to manage. It willmake you job much easier.

Good luck.

Jay Eckles
www.jayeckles.com

by shanghai sam

Jay

Thanks for the answer, very relevant. I wanted to stay away from using Frames. I will have a look at the link and try out some SSI. What are the security concerns aweston2@csc.com ? I will also look into third party software for managing templates. Many thanks for your help. I have book marked you site.

Alan

This discussion is closed to new replies.