Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get current page name for page active class

<?php
$url = basename($_SERVER['PHP_SELF']);
?>
//nav bar
<li  <?=  ($url === "dashboard.php") ? "class='active'"?>><a href='dashboard.php'> Dashboard</a></li>
<li <?= ($url === "bankdetails.php")? "class='active'"; ?>><a href="bankdetails.php"> Bank Account Details</a></li>
 
PREVIOUS NEXT
Tagged: #current #page #page #active #class
ADD COMMENT
Topic
Name
1+8 =