SSI's in v5
SSI's in v5
I recently created SSIs on my home page however when I reference them in subpages they do not follow.
What is the proper code for referencing a SSI from a single directory throughout my site.
I have created
<!--#include file="header.txt" -->
However, it only works in one directory, is it possible to use the SSI above throughout my site?
Thanks.
What is the proper code for referencing a SSI from a single directory throughout my site.
I have created
<!--#include file="header.txt" -->
However, it only works in one directory, is it possible to use the SSI above throughout my site?
Thanks.
Re: SSI's in v5
It's possible to use anything throughout your site provided it is coded correctly.jwm1205 wrote:<!--#include file="header.txt" -->
However, it only works in one directory, is it possible to use the SSI above throughout my site?
In your case, since you said header.txt works on the home page, I have to assume that header.txt is in the same directory as the home page. What you need for the rest of the site (those pages in other directories) is server-relative addressing (this would also apply to the include on the home page). Simply code your include like this...
Code: Select all
<!--#include file="/header.txt" -->
John
Still having problems...
I have tried that. The code I have is as follows on all subsequent pages to my home page:
<!--#include file="/header.txt" -->
However, once I load the page I receive the following error at the top of my page where my header should be placed:
[an error occurred while processing this directive]
The header.txt file is located in my main directory and I am puzzled why it will not duplicate on other .shtml pages within my page. The chmod is 754 for the pages I am trying to access with the SSI.
<!--#include file="/header.txt" -->
However, once I load the page I receive the following error at the top of my page where my header should be placed:
[an error occurred while processing this directive]
The header.txt file is located in my main directory and I am puzzled why it will not duplicate on other .shtml pages within my page. The chmod is 754 for the pages I am trying to access with the SSI.
yeah ASP pages and the like with automatically parse up and use these includes without any further direction. But because you are using a htm or html file, as John said, you need the s in front so it would be shtml or shtm. The s prefix tells the server before it actually opens the file that there may be includes in the file and it should whip through it and take care of any pre-processing that needs to be done.
Dave Hergert
Software Engineer
"Helping to make the menu better, one
at a time."
Software Engineer
"Helping to make the menu better, one

I find the same problem
I am having the same problem.
Pages are shtml pages.
ssi is as follows:
<!--#include virtual="/includes/ssi_menu.shtml" -->
With this code it shows the 3 .js files that are saved into the includes file, but will not show the menu on preview.
I uploaded all files just in case it needed to be on server to show..still nothing.
Anymore ideas ?
Thanks for any help.
zjoker
Pages are shtml pages.
ssi is as follows:
<!--#include virtual="/includes/ssi_menu.shtml" -->
With this code it shows the 3 .js files that are saved into the includes file, but will not show the menu on preview.
I uploaded all files just in case it needed to be on server to show..still nothing.
Anymore ideas ?
Thanks for any help.
zjoker
tried everything..still nothing
I just seen the post recommending changing the include from a .shtml file to a htm file...That didn't work either...any more suggestions ?
fixed the problem for future ssi posts
ok..after sleeping on the issue, I have now fixed the problem with using the menu as ssi. I simply added " ../" in front of all .js files that I am calling for.
Example:
<script language=JavaScript src="../menu_data.js" type=text/javascript></script>
This will call for the .js file from the correct location.
This will not display the arrow image or other images added. To fix this problem you can call for the image as an abosolute location file..such as http://mysite/images/arrow.gif
Example:
<script language=JavaScript src="../menu_data.js" type=text/javascript></script>
This will call for the .js file from the correct location.
This will not display the arrow image or other images added. To fix this problem you can call for the image as an abosolute location file..such as http://mysite/images/arrow.gif
Re: fixed the problem for future ssi posts
That's fine unless/until your site (and calls) moves to other levels. Then you're stuck with changing that call to ../../, ../../../, etc.zjoker wrote:ok..after sleeping on the issue, I have now fixed the problem with using the menu as ssi. I simply added " ../" in front of all .js files that I am calling for.
Example:
<script language=JavaScript src="../menu_data.js" type=text/javascript></script>
John
Re: fixed the problem for future ssi posts
That is true, but that allows me to be able to make changes to my menu for each level rather than each page.
A 6 level website would be able to store 6 menus with various ../../../ for each level represented...Any changes in the futurte would be x6 instead of x1500 (assuming a 1500 page website).
A 6 level website would be able to store 6 menus with various ../../../ for each level represented...Any changes in the futurte would be x6 instead of x1500 (assuming a 1500 page website).