nutt318 Posted October 9, 2007 Share Posted October 9, 2007 Hi, I am needing some help with a current ID select. My problem is that I went to using a header.php and I am including it on my index.php main page. So therfore i will not have to make changes to everpage but just the one header.php page. Here is my code I used to have that also has a .css file that underlines the selected link. <div id="menu"> <ul> <li id="current"><a href="index.php" accesskey="1">Home</a></li> <li><a href="aboutus.php" accesskey="2">About Us</a></li> <li><a href="news.php" accesskey="3" title="">News</a></li> <li><a href="services.php" accesskey="4" title="">Services</a></li> <li><a href="contactus.php" accesskey="5" title="">Contact Us</a></li> </ul> </div> So now that i have just one file that contains the header.php info and the above code how can i still use the id="current" feature when I cant edit it for each page? Is there a way to make it underline the link that the current page is at? Quote Link to comment https://forums.phpfreaks.com/topic/72405-help-with-a-current-id-on-a-header/ Share on other sites More sharing options...
MasterACE14 Posted October 9, 2007 Share Posted October 9, 2007 you've lost me sorry ??? Quote Link to comment https://forums.phpfreaks.com/topic/72405-help-with-a-current-id-on-a-header/#findComment-365147 Share on other sites More sharing options...
nutt318 Posted October 9, 2007 Author Share Posted October 9, 2007 let me try to re explain this. The code in the first post was in every page of my website, so therfore i could always change the current id so it would underline the link that they are visiting. I have now designed my site to do an include header.php which now contains the code posted and therfore i cannot manually change it for each page to underline the current page they are on. Basically the code made it easy to tell you which page you where on by underlining the menubar link. But now that i am using only 1 code that includes it to every page i cant figure out how to make it select the correct link. Im not sure if worded that right, let me know if you have any other questions. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/72405-help-with-a-current-id-on-a-header/#findComment-365152 Share on other sites More sharing options...
Michan Posted October 9, 2007 Share Posted October 9, 2007 It sounds like this is more of a CSS problem - are you including the CSS file with each page? If not, that may certainly be the problem. Quote Link to comment https://forums.phpfreaks.com/topic/72405-help-with-a-current-id-on-a-header/#findComment-365153 Share on other sites More sharing options...
nutt318 Posted October 9, 2007 Author Share Posted October 9, 2007 yes, the CSS is included on each page. But my problem is that now I have my main index.php file which is my main homepage, I have done an include "header.php"; so that it pulls just the top part from header.php. This way I only have to edit header.php if i want to change something and not everypage if i just would have put that code in the original index.php. So now that I have 2 different files, index.php and header.php, The code from before with the id="current" used to be on every page, now just header.php. My problem now is when someone goes to say, the news.php, I cant get the id="current" to change to underline the news link on the header.php. I am guessing that i need some type of varialbe that will read what page I am currently on and put that feild into the correct spot to underline the correct link in the header. Hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/72405-help-with-a-current-id-on-a-header/#findComment-365355 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.