I'm building a website while also trying to keep changing code an easy task. For that, I include the navbar with
<?php require_once('./includes/navbar.php'); ?>
so that I only need to change the navbar.php
to see changes site-wide.
I also use Bootstrap 5 and let it take care of styling the currently active page by using
<a class="active">
(and also using the recommended aria-current="page"
attribute).
Now my problem is that I need to somehow dynamically apply the above mentioned class and tag to only the active page. I have no idea how to do that in an elegant way but thought that this might be possible in PHP?
Does somebody know how to do it?
Click here to see code of the navbar
Aucun commentaire:
Enregistrer un commentaire