How to Make an External menu That Changes Everywhere

Discussion in 'HTML & Website Design' started by briancollins, Dec 29, 2006.

  1. #1
    Hello,
    I have a huge 100+ page site planned, I want to make the menu and navigational links so that if I change it once and re-upload it, the file / menu will change on every page that the menu file is inserted into.

    Do I have to make a menu a seperate file ?

    Can someone please tell me the file exentsion the menu has to be and how to do it, as well as the insert code that needs to be placed on the page(s) that I want the menu to appear at.

    To clarify if I change the menu and upload, it will change on everypage the menu is in ?

    Thank you for your time.

    Brian
     
    briancollins, Dec 29, 2006 IP
  2. slickricky

    slickricky Active Member

    Messages:
    240
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    This is a simple function that you must use a scripting language for called "server side includes". I use PHP, but you can also use ASP or SHTML. And you name the file .php, .asp, or .shtml in order to use that language.

    For PHP, it would look like this:

    <?php require('mynavigation.html'); ?>

    The relative path to the file you want to include would go in between the quotes.
     
    slickricky, Dec 29, 2006 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or just <?php include('mynavigation.php'); ?> instead.

    Why the .php extension? That way if someone finds your include file, they won't be able to see what's inside.
     
    Dan Schulz, Dec 29, 2006 IP
  4. briancollins

    briancollins Peon

    Messages:
    53
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks, I went with the .php option as I was told how to do this a little while after making the original post.

    Thanks for the replies though.
     
    briancollins, Dec 30, 2006 IP