PHP instead of iframes

Discussion in 'PHP' started by 8everything, Jan 11, 2007.

  1. #1
    Can someone help me with creating frames via PHP instead of HTML?

    I know there are suppose to be several php files where you "stick" them together in 1 HTML file.. so when you edit 1 page (ex: the navigation) the rest of the site doesn't need to be edited manually since it will appear on the other pages too... basically what iframes (in HTML) do, but in PHP.

    Does anyone know where I can find a generator or help me create one? I only need a header, navigation and content area.

    Thank you :)
     
    8everything, Jan 11, 2007 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The idea is you have a header and footer file, that you include in every page, then it appears to the browser as just one page:

    
    <?php
    include ('header.php');
    echo "Web page content";
    include ('footer.php');
    ?>
    
    PHP:
     
    matthewrobertbell, Jan 11, 2007 IP
  3. 8everything

    8everything Peon

    Messages:
    16,350
    Likes Received:
    903
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks :)

    So I now have 2 PHP files (header and footer) and I created an index.html page with that code above.. now how do I make the header and footer.php appear on the page? (index.html)

    Thanks
     
    8everything, Jan 11, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You need to rename the index file to .php (or there's other solutions but this is easiest).

    If you make index.php with:
    <?php include 'header.php'; ?>
    blah di blah
    <?php include 'footer.php'; ?>
    Code (markup):
    When you view the index page in your browser it will print out the contents of the header.php file, followed by 'blah di blah', followed by the contents of the footer.php file.
     
    rodney88, Jan 11, 2007 IP
    8everything likes this.
  5. 8everything

    8everything Peon

    Messages:
    16,350
    Likes Received:
    903
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Finally had the time to work on this. When I used the code, I didn't need to add any width or height, it adjusted it automatically for me!! it's PERFECT And it works thanks!! :)
     
    8everything, Jan 15, 2007 IP