Hello from Sweden
I´ve read this post:
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?
Example: when I click on the menu "expo" from the directory "bildarkiv" the url vill be like this:
The part "/arkivet/" is to much.
It must look like this http://localhost:8888/www_nywebb/expo/.
From the startpage to a directory and back again, everything works fine.
What can I do to make this to work?
Any help would be very nice Thanks in a million
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.
Just use absolute links. All your links should look like this...
I´ve made a duplicat of my "menu file".
So I use two "menu files" - one saved in the same folder as my start page and the second file in my "includes folder".
Thank you for your help it made my day.
All the best Erland
Good. Bu why not just us absolute links and only have one include to update?
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.
This topic is now closed. New replies are no longer allowed.