I don't know whether should I post my problem in this forum or some else. However, is there any method to auto select css tab with corresponding link. I mean to say when ever you open any link from web site its corresponding css tab automatically shows selection(highlighted). I come to know after heavy searching that it can be done through php url recognizing function, but I am not getting any proper method...

please help..


hello servis...
the following function will get your page name:

$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
$pagename=$parts[count($parts) - 1];
echo $pagename;

And then, compare your required page name with $page name by using if condition, then make your table get highlighted...
by this:

<? if($pagename=="index.php"){?>
		 <li><a href="index.php" title="css menus" class="current" >Home</a></li>
		<? } else {?>
		 <li><a href="index.php" title="css menus" >Home</a></li>
		 <? }?>

Hope this will help you for something...

thank you Shanti Chepuru, actully, i am requiring something like that....
i will try it and then let you confirm....

yes the code is working very much fine...
please can you explain me the functions on line 2 and 3.


Actually the $currentFile gives you the whole path of your file ,something like web/mysite/index.php
These two lines

$parts = Explode('/', $currentFile);
$pagename=$parts[count($parts) - 1];

to get out the pagename from the whole path...
Instead of this two lines code you can simply use this:

basename( $_SERVER["PHP_SELF"]);


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.