Simple IF Statement To Call Class
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...
<p class='some classes <?php echo (basename($_SERVER["SCRIPT_NAME"]) == 'contact.php') ? ' .selected' : ''; ?>'>foo</p>
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Cool, thanks for that NogDog
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)