I've got this problem - I use several external .js files throughout my website, and was thinking it would be efficient to just put those links in an SSI. So here's the SSI file (ssi.htm) ----
<script language="JavaScript" src="scripts/mouseover.js" type="text/javascript"></script>
<script language="JavaScript" src="../../scripts/mm.js" type="text/javascript"></script>
----
Sorry if it looks a little messy. Basically it's just the html to link the external .js files.
Now in the <head> tag of my site, I put the following code ----
<!--#include virtual="header.htm" -->
----
But it doesn't work! Can anybosy shed some light on this? Perhaps I've just got a syntax error or something?
Thanks in advance,
Matt..
Thanks again,
Matt..
Now you mention I have had similar non-sensical problems.. Try using the file attribute instead of virtual.. i.e. <!--#include file="header.htm" --> -- This bodge has worked for me in the past when the SSI wasn't behaving.
Josh
Example
INCLUDE FILE (inc.htm): hello this is the include
FILE REQUESTED: if the include works then the include will appear here <!--#include file="inc.htm"-->.
Then anything that requests your page will receive the almagamated file that would look just like this:
if the include works then the include will appear here hello this is the include.
Hope that helps clear it up. As a side note - beware of using the same metas on every page (i guess that is what you are possibly thinking of doing) as this may not be the best way to SEO your site.
To have your documents parsed by the server you need to tell the server what file extension to parse. Most servers will not parse htm or html documents because this will slow down the machine. So, it has become a standard to use something like 'shtml' for server parsed documents, yours may be something else. To include a document with the virtual attribute, such as <!--#include vitual="header.htm"-->, header.htm must be a server parsable file. So if you change the name of the file to header.shtml, or what ever file extension you are using, this will fix your problem. Such as <!--#include virtual="header.shtml"-->
Basically, the file you are including with the virtual attribute MUST be an SSI document itself.
Includes with the 'file' attribute do not have this limitation.
I hope that was helpful as I run into this many times and find it a common challenge with my clients also.