Adding a sidebar for each page

Discussion in 'HTML & Website Design' started by RFlame, May 13, 2008.

  1. #1
    So I am looking to add an HTML sidebar for each page that will be the same for each page while the content of all the pages differ.
    I have tried using an include for the HTML file in the place where the usual code would be (I took the code for the sidebar, dumped it in an HTML file and included that file as a replacement for the normal code), but it didn't work.
    Can someone tell me how to do this?
     
    RFlame, May 13, 2008 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    Are you running php? If so, try this.

    1) Raname the file form _____.html or _____.htm to _____.php

    2) Create "sidebar.php" file as a new file.

    3) Put your html code for the sidebar in this sidebar file.

    4) In your main files that you converted to .php, add this code.
    <?php include "sidebar.php"; ?>
    Code (markup):
    Then it should show the contents of sidebar.php on every page you include it.

    any questions feel free to ask.
     
    crath, May 13, 2008 IP
    RFlame likes this.
  3. RFlame

    RFlame Peon

    Messages:
    129
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ah perfect, the file to be included had to a PHP file. Thanks, +rep ^^
     
    RFlame, May 13, 2008 IP
  4. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #4
    Thank you much :) Good luck with your project!
     
    crath, May 13, 2008 IP