Micro Niche Builder
+ Reply to Thread
Results 1 to 4 of 4

Thread: Simple php active menu.

  1. #1
    Fresh Meat kidzrback is on a distinguished road kidzrback's Avatar
    Join Date
    Oct 2010
    Location
    Hamilton Ontario Canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple php active menu.

    Hey all,
    Most menus that are on web sites have no active link. You know, a way to visually see which page you are on. CSS included menus are usually all clickable, even if you are on that page. As anyone knows who uses either HTML or CSS, the active tag is not really active. It is just active when you are clicking it.
    Ok enough of theory.
    Here is a small php script that can be included on each page which you can design how you wish the 'active' link to be displayed.

    PHP Code:
    <!-- footer menu include -->
    <?php
    echo "<div class='footer'>";
    $page_loc = array(1=>'/index.php''/hosting/index.php''/design.php''/contact.php');
    $page_name = array(1=>'Home Page''Web Hosting''Web Design''Contact Form');
    foreach( 
    $page_loc as $key => $value ){
        if( 
    $_SERVER['PHP_SELF'] == $page_loc[$key] ){
            echo 
    ": $page_name[$key] :";
            } else {
            echo 
    "<A HREF='$page_loc[$key]'>: $page_name[$key] :</A>";
            }
        }
    echo 
    "</div>";
    ?>
    I've used a copy for my footer on a site.
    Quick explanation:
    $page_loc is an array of your actual pages. Note that you can put references to pages off of the main public_html ( or what ever your main site is located ).

    $page_name is the name that will appear in your menu.

    By picking up $_SERVER['PHP_SELF'], it displays that link as a text link and not a hyperlink. All other menu items are displayed as hyperlinks.

    Now, in your footer CSS file, you can define how you want the text, background colors, images etc. The colons ( : ) I put in are just for my site, they have no significance.

    Have fun with it, let me know if there are any problems.


  2. Micro Niche Builder

  3. #2

    Default

    I have seen this script already but yes i agree with you its very useful to create active links. Thanks for sharing it, mate.

  4. #3

    Default

    awesome share!! thanks dude

  5. #4

    Default

    Really very useful information i found from your post. I totally agree with you.

    Cheap Cars

+ Reply to Thread

Similar Threads

  1. Simple 3D Effect Wrap-Around Navigation Menu In Photoshop
    By decipher in forum Design and Development
    Replies: 1
    Last Post: 11-01-2010, 04:02 AM
  2. NOT ACTIVE
    By imported_Tom in forum General Discussion
    Replies: 1
    Last Post: 01-12-2009, 05:38 AM
  3. Active X ?
    By afdholtea in forum Computers & Internet
    Replies: 2
    Last Post: 05-13-2007, 11:16 AM

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