Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Html page inside another

Status
Not open for further replies.

tfstom

Programmer
Sep 28, 2002
190
US
I have an html page that I am using that has a logo on top and I have many other pages that I want to put into the page while I start moving all the HTML code below the <body> tag into the pages.

Here is a sample page:

Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>Intranet</title>
<!-- TemplateEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<link href="../contour.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#000099">
  <tr height="100">
    <td><img src="../images/Contour_logo_intranet.jpg" width="100%" height="100"></td>
  </tr>
  <tr>
    <td valign="top">
		<!-- TemplateBeginEditable name="content" -->
		<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table>
		<!-- TemplateEndEditable --></td>
  </tr>
</table>
</body>
</html>

at the "<td>&nbsp;</td>" line (about 9 lines up) - is there a way to include a total html file (<html> tags and all), just to quick and dirty get the pages up?

Thanks,

Tom.
 
You can use an IFrame ( or use Server Side Includes (SSI) if your host supports it.

bearing in mind if you can use SSI having the extra <html> etc tags in there may well cause problems with browsers other than IE.



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
Is that ASP? If so you can use ASP includes (almost identical to SSI) to include other files in your pages. See for how to use them.

You seem to have it back-to-front though. You shouldn't be trying to include the content into a page that has the menu and other fixed elements hard-coded, but to include the fixed elements into each content page. Each page could look something like this:
Code:
<html>
<head>
<title>My Page Title</title>
<!--#include virtual="/head.inc"-->
</head>
<body>
<!--#include virtual="/bodytop.inc"-->
<h1>My Page Title</h1>
<p>This is the content of the page</p>
<!--#include virtual="/bodybot.inc"-->
</body>
</html>
That's how I code my pages. All the stuff that goes into every page's <head> goes in one file; page headings, navigation menus, and other stuff that appears on every page go into two others; The unique content of each page remains in a well-formed, but rather basic, html file.

Check out faq253-3309 and faq253-2000 for more about includes.


-- Chris Hunt
 
I did try to include the HTML page, but it didn't work.

It messed up the tables and the rest of the page.

Also, I was just looking for a way to quickly (and temporarily) put our current pages into a framed window (not to be confused with frames) just to be able to get the whole site up quickly and then slowly make changes to convert from ASP to ASP.NET with our new logo and menu setup.

If I had to do all the includes, I might just as well just open each file and copy all the code between the <body></body> tags (which is probably what I am going to do).

Thanks,

Tom
 
Then an iFrame is the way to go. (As suggested by ChrisHurst)

Wow JT that almost looked like you knew what you were doing!
 
If you're going for cross-browser compatibility, my suggestion won't work, but if you're looking for an IE4+ only solution, DHTML offers a quick option:

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

Put the above in the <BODY> section where you want the page to appear, and that'll do it. NS users, however, see nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top