I'm trying to make a seperate page and use my header and footer still! HTML in PHP???

Discussion in 'PHP' started by snapplekid13, Apr 13, 2007.

  1. #1
    OK I am making a new page in PHP because all my pages are in php an just wanna keep it that way and I'm using a script!

    Now I want to include my
    Header
    HTML
    Footer

    so how would I do that?

    I tried but I keep getting my footer and header mixed around and the html is at the very top!
     
    snapplekid13, Apr 13, 2007 IP
  2. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <?php
    include_once 'header.php';
    echo "
    <p>
    This is some sample HTML code
    </p>
    ";
    include_once 'footer.php';
    ?>
    
    
    PHP:
     
    bobby9101, Apr 13, 2007 IP
    commandos likes this.
  3. snapplekid13

    snapplekid13 Active Member

    Messages:
    1,475
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    90
    #3
    OK thanks, I will try that now!
     
    snapplekid13, Apr 13, 2007 IP
  4. snapplekid13

    snapplekid13 Active Member

    Messages:
    1,475
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    90
    #4
    snapplekid13, Apr 13, 2007 IP
  5. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Make sure that the header.php file is actually not the footer.php file
     
    bobby9101, Apr 13, 2007 IP
  6. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #6
    post the contents of all the files
     
    bobby9101, Apr 13, 2007 IP
  7. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #7
    of course it will stay the same

    when you make a call like : include_once 'header.php';

    what you are doing here is getting the result of the execution of header.php and insert it .

    same here : include_once 'footer.php';

    so at the end you will only have html that come from the 2 file + the middle code .
     
    commandos, Apr 13, 2007 IP
  8. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #8
    No, he is saying that footer.php is above header.php
     
    bobby9101, Apr 13, 2007 IP
  9. snapplekid13

    snapplekid13 Active Member

    Messages:
    1,475
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    90
    #9
    yes thats what I'm saying

    and I'll test with footer first and header second!
     
    snapplekid13, Apr 13, 2007 IP
  10. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #10
    commandos, Apr 13, 2007 IP
  11. snapplekid13

    snapplekid13 Active Member

    Messages:
    1,475
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    90
    #11
    weird when i tested footer/header switch it stayed the same but the HTML showed up!
     
    snapplekid13, Apr 13, 2007 IP
  12. bobby9101

    bobby9101 Peon

    Messages:
    3,292
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    0
    #12
    It is your css, not your PHP
     
    bobby9101, Apr 13, 2007 IP
  13. snapplekid13

    snapplekid13 Active Member

    Messages:
    1,475
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    90
    #13
    w00t gt it workin :)
     
    snapplekid13, Apr 13, 2007 IP