I'm trying to create a navigation on my webpage however using php templates for the nav makes it difficult to add the active class to the right page.
For example, if my php file is the below:
<nav>
<ul>
<li><a>Home</a></li>
<li><a>About</a></li>
<li><a>Contact</a></li>
</ul>
</nav>
How do I give each page the class .active
?
The only alternative I can see is giving either <html>
or <body>
a class of each page name on that specific page.