Step1: In Header page Modified navigation link as per your need
<li class=”nav-item <?php if ($phpSelf==”index.php”) { echo “active”; } ?>”><a href=”index.php” class=”nav-link”>Home</a></li>
<li class=”nav-item <?php if ($phpSelf==”about.php”) { echo “active”; } ?>”><a href=”about.php” class=”nav-link”>About</a></li>
<li class=”nav-item <?php if ($phpSelf==”menu.php”) { echo “active”; } ?>”><a href=”menu.php” class=”nav-link”>Menu</a></li>
<li class=”nav-item <?php if ($phpSelf==”blog.php”) { echo “active”; } ?>”><a href=”blog.php” class=”nav-link”>Stories</a></li>
<li class=”nav-item <?php if ($phpSelf==”contact.php”) { echo “active”; } ?>”><a href=”contact.php” class=”nav-link”>Contact</a></li>
<li class=”nav-item cta”><a href=”reservation.php” class=”nav-link”>Book a table</a></li>
Step2: Open particular page like index.php,about.php so on..
Step3: Add these code before including header.php
$phpSelf = trim(basename($_SERVER[‘PHP_SELF’]));
That’s It. Now you can see your navigation link has active class
Thanks. Basant Mallick
Laravel has become one of the most popular PHP frameworks because it enables developers to…
Git Commands Cheat Sheet: 15 Essential Git Commands Every Developer Must Know Git is one…
Creating dependent dropdowns in CakePHP 2 involves using AJAX to dynamically load data into the…
just add below code in column properties id Default input Method: 1nextval('form_submissions_id_seq'::regclass) Method: 2 Via…
Learn how to efficiently set up auto-increment columns in PostgreSQL with this step-by-step guide. From…