I am creating menu, and if the specific page is current , menu item assign different color. Simple situation. So i do :
<?php $page = $_SERVER['SCRIPT_NAME'];?>
<?php if ($page == "index.php"){ echo "class='active'";} ?> >
<a href="index.php">Home</a>
That works for every page, except one. I tried some other options suggested on stackoverflow
How to get current PHP page name , like :
echo basename($_SERVER['PHP_SELF']); returns file_name.php
and
if(basename(__FILE__) == 'file_name.php') {
//Hide
} else {
//show
}
Still does not work.