Omit the double dots.
Double dots means "up one level".
Keeping track of that down multiple levels is a nightmare.
Use /nav-left.ssi with a leading slash so that you always "count from the root".
I agree, navigating from the root keeps things so much cleaner and easier to use, less confusing when you are trying to determine where your current filepath is too. If you are on Apache use virtual, not file -- virtual [httpd.apache.org] is much more useful.
With "counting from the root" the current location becomes irrelevant.
That's why I find it so useful.
Sorry, but none of those solutions work. Perhaps I didn't explain this properly. I want to bring in the ssi file that is up one level.
I am only putting the html page down one level of directory. Surely the double dots points the link back at the root directory where the SSI file is?
I am not on Apache (Windows IIS), so the virtual option doesn't seem to work either.
So, if the html page and the ssi file are in the same root directory I have been using <!--#include file="nameofile.ssi" -->
Then I put another page one directory level down, but keep the ssi file in the root directory, shouldn't it become <!--#include file="../nameofile.ssi" -->
Ah, ok. I realised that it was the images in the ssi file that were not showing up. I suppose I will have to use absolute links for them.
Yes. Use the same "starts with slash" URL format for all links to CSS, JS, images, etc.
|I have been using <!--#include file="nameofile.ssi" --> |
See coopster's previous post - the "rule of thumb" with SSI is if it's in the same directory, use file, if it's in a different directory, use virtual..
<!--#include virtual="/nameofile.ssi" -->
<!--#include virtual="/dir/nameofile.ssi" -->
The "dot syntax" will always get you in trouble, or at least confused. Do the same within your SSI files:
(An ailment similar to Larry Wall's "toothpick syndrome")
|Then I put another page one directory level down, but keep the ssi file in the root directory, shouldn't it become <!--#include file="../nameofile.ssi" --> |
It could, but if you use the previous advice and do
you can move it anywhere.
Adapting this habit will allow you to move your files anywhere on your system and they will always connect, you won't even have to look. :-)
Thanks. But will that method work on a windows IIS server? I thought I require Apache?
Ah. Thank you thank you everyone. It all falls into place at last. Just need to test everything on the server and I'm good to go.