using 'includes' -- help?

  1. #1
    belle is offline Newbie

    Question using 'includes' -- help?

    I am looking for help with php files, and using includes.

    i have a menu across my page that I use on all my pages, and i want to use an include file so that when i update it, it updates all the pages' menus, and not have to go thru each page.

    I was told I needed to make the menu a .php file and use an include command on the pages, but I'm not sure of the command, i guess, because it doesn't work when I try.

    can someone post an example of the html I need for this? or recommend a good site to get help?

    thank you


  2. #2
    D-A-L is offline D-A-L Administrator
    Hey,

    Yep its easy. Create your include page with your info in i.e your menu, then save that page as say menu.php then on each page you want to call that menu use the PHP code

    Code:
    <? include("menu.php") ?> 


    This will call your menu.php in.

  3. #3
    belle is offline Newbie
    Ive done that and it isn't working
    i put the menu on a blank html page, named it menu.php and then used the command like you typed on the webpage I wanted the menu on, and its not there, the table is empty
    am i missing a step somewhere?

    http://www.bellesartisticrealm.com/index2.html

    thats the test page im trying to put it on, the menu should appear under the top image in that empty table.

    when i open the menu.php file in internet explorer, it opens and works, its just not working as a command on the index2 page

  4. #4
    D-A-L is offline D-A-L Administrator
    Hi

    Sorry I wasn't very clear... Try putting
    Code:
    <?php include( "menu.html" ); ?>
    in the page which calls the menu and call the menu page menu.html

  5. #5
    belle is offline Newbie
    it's still not working...is there something I need to do with my server? or another file or something to make this work?

  6. #6
    D-A-L is offline D-A-L Administrator
    Hey belle,

    Sorry I haven't been much help I'm in the middle of a few things, can you try here http://www.hardcoder.com/scripting/p...lude_files.php this should shed some more light and post back with queries.

  7. #7
    cc98 is offline Newbie
    Quote Originally Posted by belle
    Ive done that and it isn't working
    i put the menu on a blank html page, named it menu.php and then used the command like you typed on the webpage I wanted the menu on, and its not there, the table is empty
    am i missing a step somewhere?

    http://www.bellesartisticrealm.com/index2.html

    thats the test page im trying to put it on, the menu should appear under the top image in that empty table.

    when i open the menu.php file in internet explorer, it opens and works, its just not working as a command on the index2 page
    You need index2 to have a php extenstion for it to work.., so index2.php

  8. #8
    belle is offline Newbie
    thank you so much cc, that was what i was missing.

    thanks for the replies, i truly appreciate the help

  9. #9
    D-A-L is offline D-A-L Administrator
    Tackle the Web with $5.99 .COM's from Go Daddy!
    Well done CC I think I was asleep that day

+ Reply to Thread