I included my header in every page which also contains the navigation which leads to the problem on how to add an active class to each nav element if the specific link gets clicked.
I found a working solution on the net.
I put this in my index.php on top:
<?php basename($_SERVER["REQUEST_URI"]) ?>
For each link I do this:
<li><a <?php if (basename($_SERVER["REQUEST_URI"]) == "index.php") echo " class='active' ";?> href="index.php">Start</a></li>
Everything works fine but of course it doesn't work at the very start if you just enter the domain name like:
www.mydomain.com
I tried:
if (basename($_SERVER["REQUEST_URI"]) != " ")
But then it will stick with the active class all the time.
How can I add something like "if it's the root just give the "Start" link and only then the active class?