Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 03-02-2006, 10:03 AM   #1 (permalink)
Sky Piercer
 
CSflim's Avatar
 
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,
__________________
CSflim is offline  
Old 03-02-2006, 10:41 AM   #2 (permalink)
Free Mars!
 
feelgood's Avatar
 
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
feelgood is offline  
Old 03-02-2006, 11:05 AM   #3 (permalink)
Sky Piercer
 
CSflim's Avatar
 
Location: Ireland
Hmmm...neither of those are particularly appealing.....
So, do most sites just do it with server side includes, or something like that?
__________________
CSflim is offline  
Old 03-02-2006, 11:36 AM   #4 (permalink)
Darth Papa
 
ratbastid's Avatar
 
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.
ratbastid is offline  
Old 03-02-2006, 12:00 PM   #5 (permalink)
Sky Piercer
 
CSflim's Avatar
 
Location: Ireland
Quote:
Originally Posted by ratbastid
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.

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.
__________________
CSflim is offline  
Old 03-03-2006, 08:27 PM   #6 (permalink)
Crazy
 
Location: here and there
Quote:
Originally Posted by CSflim
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.
nope, html is stateless and single request response. so either ssi/scripting server side or javascript client side. probably be just about the same code, only difference is where it gets executed. I would opt for server side myself.
__________________
# chmod 111 /bin/Laden
theFez is offline  
Old 03-03-2006, 10:57 PM   #7 (permalink)
Free Mars!
 
feelgood's Avatar
 
Location: I dunno, there's white people around me saying "eh" all the time
Quote:
Originally Posted by CSflim
I want to keep things as straight forward as possible, and to avoid anything server side like PHP, SSI, etc.
Any ideas?
Thanks,
I thought you didn't want ssi
__________________
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
feelgood is offline  
Old 03-04-2006, 05:57 AM   #8 (permalink)
Sky Piercer
 
CSflim's Avatar
 
Location: Ireland
Quote:
Originally Posted by feelgood
I thought you didn't want ssi
I wanted to avoid it if possible. Thought there might be a simple way to do it client side. But neither javascript nor frames are ideal.
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.
__________________
CSflim is offline  
Old 03-05-2006, 10:33 AM   #9 (permalink)
Registered User
 
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.
nezmot is offline  
Old 03-06-2006, 05:05 PM   #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.
manalone is offline  
 

Tags
file, html, including


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 02:21 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62