Hi, i have just finished coding a design into html / css. I have spit the code up into php includes for the HEADER, NAVIGATION and the FOOTER I have coded my navigation so that when a tab (page) is selected from navigation it has a different style. I have declared this style in the css called .selected Can someone help me write a simple IF statement, that will work like this: IF the current page is 'contact.php' echo '.selected' ELSE do nothing I was hoping to past this IF statement into the code for each tab / button so it would use the .selected class if it was on that page, thanks in advance for your help...
Bit of a hack script haven't tested - try it out to see if will do the job. <?php if(!empty($_SERVER['PHP_SELF'])) { echo '<link rel="stylesheet" type="text/css" href="'.getcwd().'/selected.css">'; } ?> PHP: ROOFIS
This is another option which you could use <a href="contact.php" <?php if([FONT=arial]$[/FONT][I]_SERVER[/I][FONT=arial]['[/FONT][I]PHP_SELF[/I][FONT=arial]'] [/FONT]== '/contact.php') echo "class='selected'";?>>Register</a> Code (markup):