www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] PHP / CSS menu

  1. #1
    Join Date
    May 2009
    Posts
    62

    resolved [RESOLVED] PHP / CSS menu

    Hi There,

    I'm trying to create a menu using PHP and CSS.

    This is what I currently have:

    <?php
    //we need to set a var to find what page we are on
    $pageOn = basename($_SERVER['PHP_SELF']);
    //this is used for the title bar
    $mItem = $pageOn;
    ?>

    <a href="index.php" <?php if($pageOn == 'index.php'){?> class="selected"<?php } else {?> class="normal"<?php }?> id="menu1">Home</a>

    <a href="about_york_office_furniture.php" <?php if($pageOn == 'aboutus.php'){?> class="selected"<?php } else {?> class="normal"<?php }?> id="menu2">About Us</a>


    This works great but I want to add another argument but not sure where it needs to go. I want to say

    "If the page is aboutus.php or meettheteam.php then class="selected" else class="normal" "

    So, in short I want to add an 'or' argument. How would I do this?

    Thanks in advance!

  2. #2
    Join Date
    Jun 2006
    Posts
    204
    PHP Code:
    <a href="about_york_office_furniture.php" <?php if (($pageOn == 'aboutus.php') or ($pageOn == 'meettheteam.php')){?> class="selected"<?php } else {?> class="normal"<?php }?> id="menu2">About Us</a>
    Thanks for the help.
    Matt

  3. #3
    Join Date
    May 2009
    Posts
    62
    That works perfectly... thankyou!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles