Add HTML Layout with require

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:01
    Add HTML Layout with require with Leanna Pelham
  • 0:08
    LEANNA PELHAM: OK, let's improve one more thing by giving
  • 0:11
    contact.php the same HTML layout as our home page.
  • 0:16
    To do this, just isolate the header and footer into their own files,
  • 0:19
    say, layout/header.php, and layout/footer.php.
  • 0:31
    Move all the HTML from the top of the index page into header,
  • 0:35
    and the stuff on the bottom into footer.
  • 0:50
    Require the header near the top of each page and the Footer
  • 0:53
    after our page-specific code.
  • 1:10
    And just like that, our two pages are sharing the layout.
Loading ...

Add HTML Layout with Require

Loading...

To wrap things up on this project, we want to update the contact page with the same HTML layout as we have on the home page. To do this, we'll move the HTML sections into their own PHP files, and use require again to get them into the right places.

Downloads: 
Log in or sign up to download companion files.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.