How to create single page for header/sidebar/footer

Discussion in 'HTML & Website Design' started by jbiggs7, Dec 5, 2012.

  1. #1
    If I have the same header/sidebar/footer for multiple html pages, is there a way to make it so that I don't have to change every single page each time?
     
    jbiggs7, Dec 5, 2012 IP
  2. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #2
    so you will include in html pages header and footer like this way
    <!--#include file="header.html" -->
    <!--#include file="footer.html" -->
     
    ashishkg, Dec 5, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    That works in some cases, but not in all cases. (It depends on the server configuration, for the most part.)

    Including the file in server-side code works in all cases. Use include('theFileName.html'); in a PHP file that has all your other html in it. There doesn't have to be any actual PHP code other than the <?php and ?> tags and the include() files. The rest can be HTML, CSS, Javascript - whatever you have now.
     
    Rukbat, Dec 5, 2012 IP