![]() |
[html] Including a html file in another html file
Hi, I am currently building a site, and I would like to create a 'template' html file which will include the menu links, headers and footers etc, and then create seperate 'content' pages.
This way I can change the template in a single location rather than having to edit a dozen pages to add a new link on the menu. What is the best way to do this? I know that it can be done with server side includes - but the problem is that I don't know anything about the server that this site will be deployed on. I want to keep things as straight forward as possible, and to avoid anything server side like PHP, SSI, etc. Any ideas? Thanks, |
Option 1
<script src="b.js" type="text/javascript"> </script> The file b.js is a javascript file can be a file that is filled with print statements like document.write("<table>") document.write("<tr>") ... and so on It's ugly, some user's browser might not even have their own javascript enabled. Option 2 You could use a frame, but that's bad practice. |
Hmmm...neither of those are particularly appealing.....
So, do most sites just do it with server side includes, or something like that? |
Sure, server-side includes are what you're after.
If your server doesn't support SSI (it has to be configured to do so) but DOES support PHP, you can rename your file filename.php and do: <? include('filename.php') ?> That target "filename.php" can contain plain HTML and embedded PHP too. |
Quote:
OK, cool. Thought there might be an easy way to do it client side, but it doesn't matter. I'll check into what capabilites the server has. Thanks both of you. :thumbsup: |
Quote:
|
Quote:
|
Quote:
The site if for a college project, and I will be emailing the files to my lecturer. He will be responsible for actually putting it online, and I don't know anything abut the target host, so you can understand why I would have preferred plain old html. Anyway, not a problem. |
You could look into using XML, XSLT and CSS - all the work is done on the client, and with some forethought, you can create a really nifty looking site, that's completely updatable just by swapping in and out of the various XML files.
|
You could try an iFrame, which is html 4.0 compliant.
http://www.htmlhelp.com/reference/ht...al/iframe.html YMMV though The w3c seems to recommend using the object tag: http://www.w3.org/TR/REC-html40/stru...dded-documents |
All times are GMT -8. The time now is 09:27 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project