Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/72405-help-with-a-current-id-on-a-header/
Share on other sites

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.