Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Fall 2019

## Recommendation: Keep files well-formed

### Don't do this: Breaking a page in half

This technique is not recommended. The first include file contains the top "half" of the page; the content follows; the second include file contains the bottom "half" of the page. In this technique, the `html` ,`body`, and perhaps other elements are started in the "top half" and their end tags are in "bottom half." The page delivered to the browser does validate, but the individual parts on the server are not well-formed, which can cause some confusion when editing a file.

    <?php include("header-tophalf.html"); ?>
      Lorem ipsum dolor sit amet, consectetuer adipiscing ...
    <?php include("footer-bottomhalf.html"); ?>

### Keeping things well-formed

    <!DOCTYPE html>
    <html>
      <head>
        <title>Lecture Notes</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
      </head>
      <body>
        <div id="header">
          <?php include("inc/header.php") ?>
        </div>
        <div id="navigation">
          <?php include("inc/nav.php") ?>
        </div>
        <div id="main">
          Lorem ipsum dolor sit amet, consectetuer adipiscing ...
        </div>
      </body>
    </html>

Copyright © David Heitmeyer