SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: PHP Navigation

  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Navigation

    Hello.
    I have a website with 3 pages:
    Home.php
    About.php
    Contact.php

    On each page there are 3 navigation buttons; 'Home'; 'About'; 'Contact'

    When you are on the home page, the 'Home' button will be blue and the about and contact buttons will be red.

    When you are on the about page, the 'About' button will be blue while the home and contact buttons will be red.

    When you are on the contact page, the 'Contact' button will be blue and the home and about buttons will be red.
    --

    What I want to do is to have just one file: menu.html
    This file will be pulled in on all pages using the PHP include function.

    If I wanted to display the same menu on each page, this would be fine. However, I want to display different coloured menu buttons on each page.

    I hope I have described my problem clearly and will appreciate any help!

    Thanks.

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do this for each link:

    PHP Code:
    <?if ($_SERVER['SCRIPT_NAME'] == '/contact.php'): ?>
      <span class="disabled">Contact Us</span>
    <?else: ?>
      <a class="navLink" href="contact.php">Contact Us</a>
    <?endif; ?>
    Then define the CSS classes to suit.


Bookmarks

Posting Permissions

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