...

View Full Version : How do I make link-paths work in sub-directories (do I use $_SERVER[]) ??



mOrloff
02-15-2010, 11:44 PM
I've got my main nav menu defined as a constant to simplify site-wide updates.

Now I want to add a subdir to the site, and use the same nav.

Here's an extremely simplified example of the resulting nav menu:


<ul>
<li><a href="home.php"></a>Home</li>
<li><a href="about.php"></a>About</li>
<li><a href="contact.php"></a>Contact</li>
<li><a href="store/index.php"></a>Store</li>
</ul>


How do I make it so that if I'm on a page in the "store" subdir, the links go to the correct dir, and don't try to find them in the "store" subdir?

I thought it had something to do with $_SERVER[], but I'm not seeing it.

Thanks in advance.
~ Mo

kbluhm
02-16-2010, 12:39 AM
Use absolute paths:


<ul>
<li><a href="/home.php"></a>Home</li>
<li><a href="/about.php"></a>About</li>
<li><a href="/contact.php"></a>Contact</li>
<li><a href="/store/index.php"></a>Store</li>
</ul>

mOrloff
02-16-2010, 01:33 AM
Oh ... seriously ?? :o
And here I was, looking for a PHP solution.

I "learned" that back in the early-mid 90's.:D
I guess all this new learnin' is pushing that old info out the hole in the back of my head. :o

But seriously, thanks-a-bunch for the help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum