Including external HTML files...?

liunx

Guest
Ok. I am incredibly confused. I'm trying to lay out a website using CSS and HTML, and hopefully nothing more. My problem, however, is thus:<br />
<br />
I want to have one file (template.html) that will contain the basic layout for my page--nav bars, headers, everything but content, basically. I have the page set up already. What I'm looking for now, is a way to take that HTML file and include it in a content page (e.g. to have content.html load the info out of template.html), so that whenever I update the layout of my site, all I would have to update template.html(rather than updating every page on my site). Is there any way to do this WITHOUT using Java, jscript, PHP, or what-not? I've been looking for a difinitive answer but havent been able to find one... help?<br />
<br />
thanks a bundle.<br />
<br />
MadCatter101<!--content-->What I've done with the site I'm currently designing is to put everything in div tags and include no styles whatsoever in the body of the page, then I have attached a .css file layout.css which arranges the content on the page and determines what size font to use, backgroung pictures etc. That way I only have to update 1 file.<br />
<br />
You can attach .css files like so:<br />
<br />
<style type="text/css" src=http://www.webdeveloper.com/forum/archive/index.php/"file.css"></style><br />
<br />
The page I'm currently designing is here (<!-- m --><a class="postlink" href="http://www.websamba.com/testorg/">http://www.websamba.com/testorg/</a><!-- m -->).<!--content-->I know what you mean, and I'm doing the same thing... BUT! What I want to do is, have one HTML file that has all but one of the <div> tags included in it (e.g. <div id=navbar>, <div id=adbar>, etc.), and include that HTML file *inside* a second HTML file, which would look something like this...<br />
<br />
<BODY><br />
<whatever code to insert template.html><br />
<div id="content"><br />
My main content for this page<br />
</div><br />
</BODY><br />
<br />
So that all I have is the one div tag in my content page. All I need is the code to insert the other HTML page...<br />
<br />
...if it exists....<!--content-->It sounds like what you need is an iframe:<br />
<br />
<body><br />
<br />
<div id="adbar">Blah Blah Blah</div><br />
<br />
<div id="navbar">Blah Blah Blah</div><br />
<br />
<div id="mainpage"><br />
<br />
<iframe src=http://www.webdeveloper.com/forum/archive/index.php/"http://www.w3.org/" name="main" width="100%" height="100%">You can't view iframes</iframe><br />
<br />
</div><br />
<br />
</body><br />
<br />
Then just target your links to the iframe.<!--content-->Thanks! I hadnt considered iframes.<br />
<br />
What I wound up using was something like this...<br />
<br />
<div id="navbar"><br />
<iframe src=http://www.webdeveloper.com/forum/archive/index.php/"navbar.html"> (with attributes, obviously) </iframe><br />
</div><br />
<br />
etc. etc. for other frames.<br />
<br />
This'll have to be c+ped into everything, but... oh well... its better than doing a frickin table every time I want to make a new page.<br />
<br />
Thanks, lava!<!--content-->Happy to help. :)<!--content-->Ooh. Someone on another forum gave me an even better way to do it:<br />
<br />
<!--#include file="template.shtml"--><br />
<br />
Simple server-side include.<br />
<br />
As long as the server supports server-side includes... hehehe. <br />
<br />
It's the closest method to what I wanted to do, since iframes are (in my opinion), more complicated to use than CSS layout. Of course, I could be crazy... but this works just as well.<!--content-->Well iframes with a css layout can be buggy on ie with relative positioning especially, I aggree with you there.<!--content-->I didn't even realise that you could do that. You'd have to be careful to delete all of the <html><head> etc. otherwise you'd have very messed up code.<!--content-->
 
Back
Top