I developed a PHP website which contains php pages. These web pages have header and footer divisions. I put both the Header and Footer divisions in separate php files and I included them using the php include function.
The problem is that I have links to the main menu in the header and the footer php files.
Before using the include function, I used the CSS Class property of the link tag to display the currently selected link in a different format.
<a id="Link_Home" class="current">Home</a>
<a id="Link_AboutUs" >About Us</a>
<a id="Link_Branches" >Branches</a>
<a id="Link_Services" >Services</a>
<a id="Link_ContactUs" >Contact Us</a>
How can I do the same after using the include function?
Should I use JavaScript to pass the id or name of the link to be the current one with that specific format and style? If so, how do I do that?
Is there a way to use PHP directly to change the CSS properties of the HTML elements so that I can modify the class property during run time? How can I do that?
I appreciate your help and thanks in advance.
If in php You can write
class="current"inside a condition like.