Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [html] Including a html file in another html file (https://thetfp.com/tfp/tilted-technology/101755-html-including-html-file-another-html-file.html)

CSflim 03-02-2006 10:03 AM

[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,

feelgood 03-02-2006 10:41 AM

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.

CSflim 03-02-2006 11:05 AM

Hmmm...neither of those are particularly appealing.....
So, do most sites just do it with server side includes, or something like that?

ratbastid 03-02-2006 11:36 AM

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.

CSflim 03-02-2006 12:00 PM

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. :thumbsup:

theFez 03-03-2006 08:27 PM

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. :thumbsup:

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.

feelgood 03-03-2006 10:57 PM

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

CSflim 03-04-2006 05:57 AM

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.

nezmot 03-05-2006 10:33 AM

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.

manalone 03-06-2006 05:05 PM

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 11:33 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


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 63 64 65 66 67 68 69 70 71 72 73 74 75 76