HTML - Help

Esteban

Explorer
Hello,

I've been trying to set up my D&D website. I used to have a javascript menu that worked fine - until IE 6 came out. Now I'm using a combination of javascript and css. I have these files in one directory as separate js and css files so I only have to make one change when I update the site. I want to do the same with an html file.

My question - does anyone no a way of importing an HTML file into a seperate HTML file? Like the css and js files, I want to be able to make one change in order to update the site. My HTML file contains the menu text and links.

I swear I cannot find an answer on this.

Any help would be appreciated.

Thanks,

Steve
 

log in or register to remove this ad

Psionicist

Explorer
Sure!

It's called SSI (Server Side Includes) and I LOVE it. YOu have to save the files as something.SHTML and have a host that supports SSI.

Let's say you have two files, file1.shtml and file2.shtml.

file1.shtml may look like this:

Code:
<html>
<head>
</head>
<body>
<!--#include file="file2.shtml"-->
</body>
</html>

and file2.shtml may look like this:

Code:
text<br>
text<br>
lots of texts

The user will see the code like this:

Code:
<html>
<head>
</head>
<body>
text<br>
text<br>
lots of texts</body>
</html>

Remember these rules:

DO NOT USE SPACE between the comment lines. A correct SSI statement looks like this:
<!--#include file="file2.shtml"-->
not like this
<!-- #include file="file2.shtml" -->

There are some different SSI command. You should use INCLUDE FILE and possible INCLUDE VIRTUAL.

INCLUDE FILE will include a file in the same folder as the document including the file.
INCLUDE VIRTUAL will include a file anywhere on the net. You have to write correct pathlines, as "http://server.net/text.txt" (you can include any textfile. The included files does not have to have the SHTML extension)

Something like that.

Experiment with it. You can only use it locally if you have an own server client installed as PWS (personal webserver). If you doesn't have one you have to upload it to your host.

REMEMBER THAT THIS WON'T WORK IF YOUR SERVER IS NOT CAPABLE OF SSI.

Post more questions here..
 


Castellan

First Post
You're going to need to use a different solution, here. Some choices include Server-Side Includes (something that should be easy if you have an Apache Web Server and they're turned on -- these are the .shtml files you see on some sites), ASP, PHP, and other solutions.

The website I administer at work is small and doesn't currently do too much, but it uses common headers and footers, and I'm using Server-Side Includes. However, we have some plans to expand the site over time, and I'm planning on migrating to PHP to do that.

These "dynamic" web pages allow you to include common files and features so that you can do less work.

Hope this helps some!
 


Remove ads

Top