I have a normal shtml file.
I use <!--#include file="footer.shtml" --> on my index page to include my footer.
I have a page in in a sub-folder and would also like to include that footer,but when I do <!--#include file="../footer.shtml" -->
It does not get included on the sub page. Not sure why?
Any help would be appreciated. Thanks. Buffmin
I used the same <!--#include file="footer.shtml" --> that I used in the index.shtml file. When it didn't work, I added the ../ and still didn't work. And it is definitely only 1 folder level down.
I tried it again with a new page. I find that if you include a say.... footer.shtml page and in the same folder, you create a page that has nothing but an include to that page it works fine. (using <!--#include file="footer.shtml" --> )
BUT if you copy that same page to a sub folder, it will no longer include the footer code, even if you add the ../ before the footer.shtml
I just get an error .... [an error occurred while processing this directive]
Does that include line show up in the comments if you view the source of the page?
Edit:
Wait, change that from file= to virtual=. Does that work?
On a side note, its been yeeeeeaaaaarrrrrssss since I've used an SSI directive. Is there a reason why you are using this instead of a processing language like PHP?
rather than use <!--#include file="../footer.shtml" -->
Change it to this <!--#include virtual="/footer.shtml" -->
and here is the explanation exact from the forum.
-------------------------
What you have should work fine, basically. Because it does not work, something else is wrong.
any path that starts with a slash means, "Start at the DocumentRoot" -- as defined in the server configuration. So if /inc/example-page.shtml is referenced in an include, but resolves to <DocumentRoot>/sub-folder/inc/example-page.shtml instead of <DocumentRoot>/inc/example-page.shtml, then either your server configuration is faulty, or it is simply not configured the way that you think it is... That is why I asked about the "Control Panel add-ons" above.
[added] Here is the code I use to include a footer on all pages of one of my sites, regardless of what subdirectory the page's file might be located in:
My apologies. I guess my eyes skimmed over that, thinking it was just one of those tid-bit (phrases) that people seem to include in their threads.
Yes, that is exactly what you suggested.
The other thing that you asked was, why am I not using a processing language like php.
Hmmm, as I am fairly new in this business, I have always had the impression that you should create sites as html unless you are going to include php code, at which time, I would save them as .php.
That has always been a question of mine. If php pages will work fine even if they do not contain php code, then why not just always save pages as php?
I mean, I have a tendancy of creating half a website, and then the client wants a page that will require php. Then, rather than having 10 html pages and '1' php page, I go back and save the other pages as php.?
I would appreciate your thoughts. Thanks again, Buffmin