PHP Includes
I'm no PHP expert but I think I've gotten the handle with PHP Includes, so I thought I'd teach you how to use them. It can make layout changing far more easier as changing one little thing to a layout instantly makes the same changes to all other pages. PHP Includes are split into three sections, the header at the top, the content in the middle and then a footer at the end. All your webpages should be saved as a .php file for example index.php or resources.php
Copy the coding below into a notepad file and save it as header.php, please note that this is just a simple non-centered layout, obiviously make your own changes where needed.
<head>
Now open up a new notepad file and paste in the code below and save it as footer.php, this page is the bottom include of your webpage, it closes off your contents div you had right at the end of the header.php page.
<title>Site Name</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<div id="header">
<h1>my website</h1>
</div>
<div id="sidebar">
<h2>welcome</h2>
<p>blah blah blah</p>
<br>
<h2>side</h2>
<p>this is some sidebar text</p>
</div>
<div id="content">
<Br>
So now you have constructed your two files, every page you have should only have the actual content you want, but to make them include your two pages (being your layout), you will need to do add this at the top of every page:
</div>
</body>
</html>
<?php include('header.php'); ?>
Then add this at the bottom of every page:
<?php include('footer.php'); ?>
Here is an example of what a page may look like:
<?php include('header.php'); ?>
What the above coding shows is yur basic coding being surrounded by your header.php (overall layout) and then your footer.php. Now this means you can change the layout of all your pages in one go, if you simply change the header.php page such as the header image, then all your pages will include your new header image as they have the header.php included!
<h1>downloads</h1>
<p>blah blah blah</p>
<?php include('footer.php'); ?>
