www.webdeveloper.com
Results 1 to 2 of 2

Thread: help with menu idea

  1. #1
    Join Date
    Jan 2007
    Location
    Cambridge, England
    Posts
    166

    help with menu idea

    I'm very new to PHP and I want to set up a menu as a PHP include. This seems very straight forward in itself but I would like the link to the current page to be styled differently to the others. I think I need to use an if statement but not sure what to use as the variables etc. Is this actually possible?

  2. #2
    Join Date
    Feb 2007
    Posts
    16
    I think what you mean is to have the button / link to the current paage highlighted to show you are on that page?
    If so, you could use something like this:
    PHP Code:
    <?php
    $highlightedlink
    ="1";
    include 
    "/*relative path to menu file*/";
    ?>
    then the menu file:
    PHP Code:
    <a href="somewhere1"><div class="<?php if($_GLOBALS['highlightedlink'] == 1) {
        echo 
    "link_1";
    ?>">Link 1</div></a>
    <a href="somewhere2"><div class="<?php if($_GLOBALS['highlightedlink'] == 2) {
        echo 
    "link_2";
    ?>">Link 2</div></a>
    /*etc etc for all your links*/
    and then you could make a css file containing all the formatting for the classes link_1, link_2, etc.

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