View Full Version : #include problems

11-19-2002, 09:23 PM
I am trying to create a framework to be included into each of my web pages so that I can make it a bit more modular. I use the following lines and they display fine in DreamWeaver, but when I post them to my hosted web site they don't work.

I've tried putting <html> and </html> outside the include files and still no luck.

1) is this a good idea to do it this way?
2) what am I doing wrong?


<!--#include virtual="header.htm"-->
<!--#include virtual="navbar1.htm"-->

HTML Text Goes Here

<!--#include virtual="navbar2.htm"-->
<!--#include virtual="footer.htm"-->

11-19-2002, 09:32 PM
are you sure that your host supports SSI? also, can we see the page that this is on?

11-19-2002, 11:57 PM
joh6nn asks a valid question. Also Don, if SSI is supported, your server might additionally require that all files containing the include directive use the .shtml extension (rather than simply .html ).

The extension is used as a "flag" to tell the server to LOOK inside the file for any directives... otherwise the server sends the page without parsing the contents.

Some servers support SSI without requiring the extension though, and these servers operate slightly more slowly than they otherwise would, because they spend time parsing the contents of every page whether or not any directives are present.

11-20-2002, 10:43 AM
Also, some servers require a space between the double quotes and the second comment tag: " -->

11-20-2002, 10:46 PM
Not sure if this is a problem, but those files (header, navbar, etc.) would have to be in the same directory (folder) as the page you're loading.

Here's a way to get around that.

If the files are in the root of your web, do this...

<!-- #Include VIRTUAL="/header.htm" -->

The "/" tells the page to start looking for the page from the root directory. Without it, it looks only in the current directory. This is the safest way to include a file since it will work from anywhere in your site.

Likewise, if they were a folder deep in your web, it might look like this...

<!-- #Include VIRTUAL="/includes/header.htm" -->

Again, not sure if this is an issue, but it was a problem I have gone through with one of my own sites.

And like realisis said, you'll have to have a page extension of .shtm, .asp or .jsp (others may work... these I know of).

11-21-2002, 12:00 AM
I am still having problems. They may be due to my web hoster, web.com. I am trying to get the simplest of PHP scripts to work, too. I'm starting to think there is something wrong with their web server.

I'll post back when I know more.

11-21-2002, 05:28 AM
I checked out web.com and it seems that in the "Unix Value Hosting" they do not support SSIs nor PHP Scripts. In the "Unix E-Silver Hosting" they do support SSIs however.

I'm presuming this is the case, because they fail to mention either in any deal below the Unix E-Silver Hosting, yet they don't fail to mention that they offer SSIs in some offers.