![]() |
![]() |
#1 (permalink) |
Sky Piercer
Location: Ireland
|
[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,
__________________
![]() |
![]() |
![]() |
#2 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
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.
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
![]() |
![]() |
#4 (permalink) |
Darth Papa
Location: Yonder
|
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. |
![]() |
![]() |
#5 (permalink) | |
Sky Piercer
Location: Ireland
|
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. ![]()
__________________
![]() |
|
![]() |
![]() |
#6 (permalink) | |
Crazy
Location: here and there
|
Quote:
__________________
# chmod 111 /bin/Laden |
|
![]() |
![]() |
#7 (permalink) | |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
Quote:
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
|
![]() |
![]() |
#8 (permalink) | |
Sky Piercer
Location: Ireland
|
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.
__________________
![]() |
|
![]() |
![]() |
#10 (permalink) |
Once upon a time...
|
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
__________________
-- Man Alone ======= Abstainer: a weak person who yields to the temptation of denying himself a pleasure. Ambrose Bierce, The Devil's Dictionary. |
![]() |
Tags |
file, html, including |
|
|