PHP Includes
If you are thinking about converting your site to PHP you might want to start out with the includes. Includes basically break down a page
it also saves alot of time. When changing anything; you will only need to change 2 files. You also should remember to change all your extensions to PHP first!
First: You should know what a basic HTML page looks like. Here is an example:
<head>
<title> PAGE TITLE HERE</title>
<link rel="stylesheet" type="text/css"href="css.css">
</head>
<body>
<div class="content"> Your Content Goes Here. </div>
<div class="footer"> This Site Is Copyright 05 © NAME</div>
</body>
Second: Now that you know that ^ you have to make a 'header.php' just copy and paste the following code:
<head>
<title> PAGE TITLE HERE</title>
<link rel="stylesheet" type="text/css"href="css.css">
</head>
<body>
Third: After you saved the above you must make a 'footer.php' to do that save this code and paste it into your footer.php
<div class="footer"> This Site Is Copyright 05 © NAME</div>
</body>
</html>
Now upload both header.php and footer.php to your site. Now when you make a new page you have to paste in this code:
<?php include ("/home/USERNAME or HOSTS USERNAME/public_html/header.php");?>
<body>
<div class="content">
CONTENT HERE
</div>
<?php include ("/home/USERNAME or HOSTS USERNAME/public_html/footer.php");?>
What now?
Well basically now you can add anything you want to your header.php and it will show up on all your pages : ) Therefore you don't have
to edit all your pages to put in a code/script, you just simply edit your header.php!
|
|