How Do I Make it So Changes I Make Are Reflected on Every Page?

Discussion in 'HTML & Website Design' started by rbf738, Mar 24, 2010.

  1. #1
    I want to have a menu system on a new site I'm putting together and I want to make it so that when I add a new item on it that it will be reflected on every page because the menu will obviously be on every page. I don't have a great deal of experience with this sort of thing, so is there some simple way to get this done?
     
    rbf738, Mar 24, 2010 IP
  2. canadianguy_001

    canadianguy_001 Peon

    Messages:
    97
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you are using PHP you can use a PHP include. This pakes it so that you have the navigation portion of your HTML in a separate file that you would include on every page that you want it on. This way, when you make the changes, it will be the same on every page as opposed to having to update it on every page individually.

    for example, you make a php file called "nav.php" that looks like this:
    <ul id="nav"><li>item</li><li>item</li><li>item</li></ul>
    PHP:
    then on your index.php file (instead of index.html) you would put the following where your nav would have been:

    <?php include('nav.php'); ?>

    Note that this will only work on a server running php.
     
    canadianguy_001, Mar 24, 2010 IP
  3. nimonogi

    nimonogi Active Member

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    80
    #3
    As canadianguy said, the best way is to include a php header and a footer as well for complete control.

    This will require to rename all your pages to .php - This could be an issue if your pages have pagerank on them.
    So, you can create an .htaccess file and add the following code in it to execute PHP code as .htm or .html and don't loose your PR

    
    addhandler application/x-httpd-php .htm .html
    
    Code (markup):
     
    nimonogi, Mar 25, 2010 IP
  4. jj1

    jj1 Active Member

    Messages:
    892
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I use Microsoft Expression where I first of all create a Master file for everything (masthead, navigation, footer etc) that will be the same for each page. The master file the feeds the info into the other pages.
     
    jj1, Mar 26, 2010 IP