Basic PHP Question - Way Of Putting Menu In PHP To Save Changing Every Page?

Discussion in 'PHP' started by bad_bob00, Mar 25, 2008.

  1. #1
    Hi there,

    I don't actually know how to use PHP but i'm wondering if theres any kind of way of doing the following...

    I have a website which has lots of html pages. I have a menu which sometimes gets updated, and was wondering if there is a way of changing the menu on just one file, and having all the other html pages automatically update to the new menu?


    Thanks for any help
     
    bad_bob00, Mar 25, 2008 IP
    Weirfire likes this.
  2. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yes.

    just put the menu on a page and link to it with PHP's include function
     
    lbalance, Mar 25, 2008 IP
  3. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Have a look at this page for some code;

    http://forums.digitalpoint.com/showthread.php?p=7109334

     
    Weirfire, Mar 25, 2008 IP
    bad_bob00 likes this.
  4. bad_bob00

    bad_bob00 Active Member

    Messages:
    3,472
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Thanks but I don't need it to show "active" tabs or anything, I just need the same menu displayed on every page.

    Sorry I would edit the php myself if I knew how to - do I simply need to delete some sections of text?


    Thanks:)
     
    bad_bob00, Mar 25, 2008 IP
  5. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #5
    Make sure the extension of your page is .php (e.g. index.php)

    Then all you need is;

    <!-- HTML Goes anywhere outside the PHP tags -->
    
    <?php
    
    include '/includes/navigation.php';
    
    ?>
    
    <!-- HTML Goes anywhere outside the PHP tags -->
    PHP:
     
    Weirfire, Mar 25, 2008 IP