I´m trying to rebuild my site with a single include menu file.
(I´m using the technic explained in the post above)
I'm using body id.
My menu list looks like this:
<li id="menu-mall1"><a href="../" > Start </a></li>
<li id="menu-mall2"><a href="arkivet/"> Bildarkiv </a></li>
<li id="menu-mall3"><a href="expo/" > Expo </a></li>
<li id="menu-mall4"><a href="om/" > Om </a></li>
<li id="menu-mall5"><a href="blogg/" > Blogg </a></li>
with my start-file at the top of my website and the rest of the contents in different subfolders.
My problem is - when I'm in another directory than the base, the links to a second directory doesn't work. How can I make this links to work?
From what I gather your 'include file' is inserting the menu as you wanted. However, you have this same (include) menu in all your files - main pages - but they are in different 'sub directories'.
Therefore when you have the 'include' within another directory it will reference something else (not available) because of the include file URL's have a static value.
You could make 'absolute links' rather than 'relative links' then it would always reference the correct URI. Or use two or more different includes for each directory. Else possibly use some PHP variables for the URL values.
To me the problem sounds like you are putting the separate pages each in their own directory -- which IMHO is always a colossal waste of time. Admittedly, I tend to use server side code so every page is routed through a SINGLE index.php, but even on a static site the principle is the same.
includes should be down-tree, aka nested in subdirectories in the order they call each-other. Pages the user is going to call, as a rule of thumb bad idea to put those in ACTUAL subdirectories.