Active Links with PHP
Posted: Fri Apr 18, 2008 7:08 pm
Hi there!
I searched through the forum, but couldn't find any answers to my problem... perhaps I'm searching for it wrong?
I'm using the script found here: http://www.crucialwebhost.com/blog/you- ... avigation/
I've gotten it to work on a few sites of mine, however; when I do mod-rewrite to drop file extensions, I have problems.
Here's the code I usually put right about my "body" tag:
And here's the code I use for the links:
That code works for a file name, other than index.php. See, when I use mod-rewrite - blahblah.com/aboutus/ I can't just put "aboutus" in there, it doesn't work.
Here's a working example of what I'm trying to accomplish:
http://www.otclothing.com/otc-golf/
When you're on the "OTC Golf" page, in the menu, the "OTC Golf" is highlighted in black. I just want that! Any help would be appreciated!
I searched through the forum, but couldn't find any answers to my problem... perhaps I'm searching for it wrong?
I'm using the script found here: http://www.crucialwebhost.com/blog/you- ... avigation/
I've gotten it to work on a few sites of mine, however; when I do mod-rewrite to drop file extensions, I have problems.
Here's the code I usually put right about my "body" tag:
Code: Select all
1. <?
2. $path = $_SERVER['PHP_SELF'];
3. $page = basename($path);
4. $page = basename($path, '.php');
5. ?>
Code: Select all
<a<? if($page == 'one') print ' class="active"'; ?> href="one.php">Page 1</a>Here's a working example of what I'm trying to accomplish:
http://www.otclothing.com/otc-golf/
When you're on the "OTC Golf" page, in the menu, the "OTC Golf" is highlighted in black. I just want that! Any help would be appreciated!