Showing results for 
Search instead for 
Did you mean: 

Alternative to #include?


Alternative to #include?

Hi all,

I want to have a standard navigation bar running down the left-hand side of the website I am developing, and I don't want to have to include this bar on every page.

At work (where we run IIS) I use '.asp' pages and '#include' statements to include the navigation bar.

As PlusNet doesn't support ASP at the moment, what are my alternatives? I have just a basic webspace at the moment (no CGI or FrontPage Extensions). Do I need to enable one of these?

Thanks in advance


Alternative to #include?

You can use SSI (Server Side Includes), which work in the same way to the #include statement.

These come in the format

<!--#include virtual="/path/to/file" -->

So if you wanted to include the file

Then you sould use

<!--#include virtual="/includes/file.htm" -->
Posts: 478
Registered: 08-04-2007

Alternative to #include?

Remember that these files need to be saved as .shtml files instead of .html/.html to work as the webserver needs to know that there is included content so that it can get it before it serves the page.

matt Wink

Alternative to #include?

Thanks for the advice.

Silly question time Shockedops: - Which file needs to be saved as 'shtml' - the included file (the navigation bar) or the other pages (the content)?

Thanks again


Alternative to #include?

Sorry. Yes, the content pages, ie, the ones that include the "<!--#include" line.

Alternatly, you can create a file named ".htaccess" and place it in your htdocs directory, with the following in.

AddType text/html .html
AddHandler server-parsed .html

Your FTP software may make this file vanish, because files starting with a "." (period) are hidden by default.

Look for a settign to display hidden files, or if it asks for the command name for listing files, set it to "ls -la".