Newbie site question

Discussion in 'HTML & Website Design' started by freshbaked, Jan 20, 2009.

  1. #1
    ok, this may be an easy thing, but I can't seem to figure it out.

    I have a site with 4-5 pages, and I'm looking to add more content to the site.

    I want to use a header & footer so that I don't need to cut & paste the entire .index page every time I add a new page.

    I have made a new page & called it header.html & one called footer.html
    But I don't know how to get them to show up on all the new pages.

    thanks for the help!
     
    freshbaked, Jan 20, 2009 IP
  2. mywebwork

    mywebwork Guest

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would be better off with PHP:

    1 - Rename your files to header.php and footer.php (you don't need to edit the code, just the file names).

    2 - You also want to name your other files with a ".php" extension. They can still be coded in HTML.

    3 - In each file you need to include the header and footer by inserting the following line "<?php include header.php ?>" at the beginning and "<?php include footer.php ?>" at the end (without the double-quotes).

    That's pretty well it. Let me know if you need a more detailed response, I'd be happy to help.

    Aloha

    Bill
     
    mywebwork, Jan 20, 2009 IP
  3. freshbaked

    freshbaked Active Member

    Messages:
    417
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #3
    thanks for the response. for some reason I couldn't get it to work. Will I need to replace the .htm extensions for every page on the site before it works?
     
    freshbaked, Jan 21, 2009 IP
  4. dlb

    dlb Member

    Messages:
    203
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    35
    #4
    Yeah. And your host should be capable of running PHP of course.
     
    dlb, Jan 21, 2009 IP
  5. Paul8368

    Paul8368 Well-Known Member

    Messages:
    614
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #5
    You could just work from a template with standard header and footer and create new pages based on the template. Depends what software you are doing your design work in. If you are using Dream weaver this is the easiest way.

    Paul
     
    Paul8368, Jan 21, 2009 IP
  6. plugandplay

    plugandplay Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    make sure you have uploaded your header.php and footer.php files to your server so that the "include" that Bill is suggesting works.
     
    plugandplay, Jan 21, 2009 IP
  7. micksss

    micksss Notable Member

    Messages:
    4,427
    Likes Received:
    268
    Best Answers:
    1
    Trophy Points:
    285
    #7
    You might need to modify your .htaccess file. I believe you want there to be this line for php to work within an html page:

    AddHandler application/x-httpd-php .htm .html

    Best of luck :)
     
    micksss, Jan 21, 2009 IP