i want to create tabbed menus for my website. ( with php ) here is an example, click on one of those menu to see.. : http://citehealth.com i want if menu is active.. For example, if I'm on the About Us page of a website, the About Us navigational tab should use a class. (css) the code should be something like this : <li (start php)class="blah"(end php)><a href="/blah"></a></li> Code (markup): php code should be inside (start php) and ended at (end php) Thanks,
why not do it like... <li (start php)class="<?= $class ?>"(end php)><a href="/sometab?class=homepage"></a></li> Code (markup): Then do everything in CSS for whatever the $class variable will hold? Highlight it a different color bring to front etc etc.
A basic version would be something like this: if ($_SERVER['PHP_SELF'] == $currentlink) { $class == "current"; } However you would need to either manually set $currentlink, or create some class / function to do it for you.
Thanks for your reply! but can you explain me a little more ? I'm newbe in php. can i use this like this without anything extra? <li <?php if ($_SERVER['PHP_SELF'] == $currentlink) { $class == "current"; }; ?><a href="/blah"></a></li> can you write a full solution for me please? please help ..