PDA

View Full Version : Insert one HTML file in another?


outlander78
08-29-2002, 04:15 PM
Hi folks.

I'm trying to write a links section which I can then include in various html pages as part of the page, much like an include statement in a programming language.

Do you know if there is an HTML tag/command which will insert, at the point of the tag, the contents of a second file?

thanks for your time,
Andrew

boxer_1
08-29-2002, 04:52 PM
Hi,

You could use SSI (Server Side Includes) if your hosting service supports them. See here for a brief explaination of SSI:

http://javascriptkit.com/howto/externalhtml3.shtml

x_goose_x
08-29-2002, 10:20 PM
Works in NS6:

<object type="text/html" width=100% height="250" data="source.htm">
</object>

Works in IE6:

<object type="text/x-scriptlet" width=100% height="250" data="source.htm">
</object>

Works in both:

<iframe src="source.htm" frameborder="0" width="300" height="300"></iframe>

boxer_1
08-29-2002, 11:44 PM
Originally posted by x_goose_x
Works in NS6:

<object type="text/html" width=100% height="250" data="source.htm">
</object>

Works in IE6:

<object type="text/x-scriptlet" width=100% height="250" data="source.htm">
</object>

Works in both:

<iframe src="source.htm" frameborder="0" width="300" height="300"></iframe>

Since I don't know what Outlander's target audience / browser is, it should be noted that the none of the above are supported by NS 4x browsers. Maybe you're not concerned with supporting that browser group, but I figured it should be mentioned, if only for the sake of this thread ;) .

outlander78
08-30-2002, 07:00 PM
Thank you for your help!

I've found an alternate method, using some PHP code, which most servers seem to support.

You can put code into a file, say header.inc, which contains the header information you want stored for use in a set of pages. Then, at the point where you want the code inserted, add the following lines:

<? require ("header.inc"); ?>

thanks for the help, folks,
Andrew

redhead
08-30-2002, 07:02 PM
if you had access to no server side technologies and didnt want to use frames you could use a JavaScript alternative...

You'd make a JavaScript document entitled "banner.js" and in it put something like this...


code='<img src="banner.jpg">';
code+="<br>";
code+="More html stuffs here...";

document.writeln(code);


and in your html page put this....

<script src="banner.js" language="JavaScript" type="text/javascript">

Hope that helps you :cool:

mitmo
09-17-2002, 03:54 PM
ok, the iframe code is perfect for what I need, but I am having trouble linking it to the source now that I am pointing to an alternate location... I am sending an HTML page thru email and want to link the frame to a page on my site... here is the code:

<!--
<iframe src="http://...../remove.html" frameborder=0 width=100% height=200 ></iframe>
-->

is it possible to link to another domain using iframe?