I break my code into chunks that make logical sense for my site.
Each code segment is included using a php ‘require’ statement. The reason for doing this is that even if only a single code segment is not loaded the whole page should be considered invalid.
The first segment is for the DOCTYPE, then meta data.
After that I build my site from other code segments that contain the header and footer information, left and right columns and main content. I think you get the idea.
I don’t know if this is technically a template but that is how I think of it. Notice in the following example of my, only slightly edited, home page there is ZERO content. The content is in the code segments.
John
<?php require (“php/docType.php”); ?>
<head>
<?php require (“php/metaData.php”); ?>
<title>Key Largo Software</title>
</head>
<body id=“home”>
<div id=“mainContainer”>
<div id=“header”>
<!-- Start Header Content -->
<?php require (“php/header.php”); ?>
<!-- End Header Content -->
</div> <!-- <div id=“header”> -->
<div id="content">
<!-- Start Main (Middle) Content -->
<?php require (“content.php”); ?>
<!-- End Main (Middle) Content -->
</div> <!-- <div id="content"> -->
<div id="left">
<!-- Start Left Column (Menu) Content -->
<?php require (“left.php”); ?>
<!-- End Left Column (Menu) Content -->
</div> <!-- <div id="left"> -->
<div id="right">
<!-- Start Right Column (Menu) Content -->
<?php require (“right.php”); ?>
<!-- End Right Column (Menu) Content -->
</div> <!-- <div id=“right”> -->
</div><!-- <div id=“mainContainer”> -->
<div id=“footer”>
<!-- Start Footer Content -->
<?php require (“php/footer.php”); ?>
<!-- End Footer Content -->
<!–
<?php require (“php/hitCounterCode.php”); ?>
–>
</div> <!-- <div id=“footer”> -->
</body>
</html>