View Full Version : What does this "#include" mean?

05-26-2005, 05:05 PM
Hello everybody,

I am studying a series of pages that use a CSS as well as three files with these names: navigate.inc header.inc footer.inc

Sadly, neither the menu, header, or footer appear on the pages when viewed by a browser.
There are statements inside several <TD> tags such as
<!-- #INCLUDE FILE="header.inc" -->
<!-- #INCLUDE FILE="footer.inc" -->
<!-- #INCLUDE FILE="navigate.inc" -->

I understand that "<!" is a comment line, so I assume I need to add something to make these three components work.
Can someone help me out with this?
What does #INCLUDE mean, or do.... and what is an *.inc" kind of file?

Many thanks for any help you might offer. I gotta start somewhere


05-26-2005, 05:11 PM
An include is a code snippet which includes one file into another. I tend to use PHP includes rather than SSI, but I think you should just leave those comment tags there.

The ".inc" part of the file-name is just an extension to make it easier to distinguish between included files and other files.

You might want to search Google for "SSI" or "PHP Includes" to find out more, as I'm sure you'll be able to find out more than I could tell you ;) .

05-26-2005, 05:18 PM
For some reason, I never had any luck with SSI includes when I tried them :confused:

I use PHP includes. To do so, and if your server supports it, use this simple code:

<?php include("yourpage.php") ?>

Jamie :)

05-26-2005, 06:50 PM
Here is a small tutorial that may be of some benefit. There are probably better ones out there on the net so google it as chilipie suggested. In the original post you had <!-- #include file="navigate.inc" -->. This is a common use for this. If you have a large site, say 100 pages or so and you want to have a common menu on every page or at least the majority of pages you can create one menu page and include it in all the pages you want the menu to show up. This way if the menu changes, and they always do, you simply have to update the menu page instead of all the pages with the menu. Also you are not limited to .inc. You can call your page whatever suits your needs. For menu pages you could use menu.nav if you want. Also your include files should contain anything that is generally used between the body tags. Although some browsers may allow you to use head and even doctype it is probably not a good idea. It may work but would probably cause validation problems (???). As you will find the include directive is really a small (limited) pre-processing language in which you can do quite a few things. My experience is limited to the use of the file attribute. I am not familiar with php (one of these days I've got to sit my wrinkled old butt down and learn this) but I have used ssi to include a variety of files for some of my projects without any problems. Also you have to ensure that your server supports it.

Good Luck



oops, i forgot the tutorial link:


05-26-2005, 06:52 PM
I usually just use it for the news and navigation parts of websites. It doesn't cause any validation problems if your code inside the included file is semantic and valid.

05-26-2005, 09:23 PM
I tend to use PHP includes rather than SSI

That statement doesn't make sense. Server-Side Includes (SSI) are an idea. PHP is one of many languages that supports the idea.

<!-- #inlclude -->


<?php include(); ?>

are two seperate implementation of one idea.

05-26-2005, 09:26 PM
Sorry, my bad :o .

What I was trying to say is I use <?php include(); ?> more often than <!-- #include file="" -->.

05-26-2005, 10:37 PM
Sorry, my bad :o .

What I was trying to say is I use <?php include(); ?> more often than <!-- #include file="" -->.

If you aren't using any other aspects of PHP, you would be better of just using SSI so the PHP engine doesn't have the parse the page and the subsecuent includes.

05-26-2005, 10:46 PM
Gah! Why must you continue the confusion? PHP includes are SSIs... SHTML includes are SSIs...

SSI !necessarily= SHTML includes...

Semantics, yes, but it's a significant distinction. No need to muddy the waters.