PHP Includes
Your site needs to have a server with php to complete this task
The Purpose: You know when you want to change your site layout, or want to add something to your side/menu bar and you really don't want to go though each file/page to change it to match all the other pages? This could take a long time and effort to do this. Well, now you don't have to! Yay, just follow the rest of this tutorial.
1. If your site is completely coded in .html like for example all your pages are, index.html, content.html, ect, you have to go though each file and change the page extention to .php, like index.php, content.php, ect. Every page has the same exact coding, but different content, right?
2. Now, were going to create a header.php file. Open one of your files. Copy everything above your content for that page. Open Notepad 0r another plain text editor. Paste what you just copied into a blank document. Save as header.php. Be sure to pick "all files" from the Save as Type dropdown box, not "text documents (.txt)"
3. Now, were going to create a footer.php file. Again, open one of your files. Now, copy everything below your content for that page. Use Notepad 0r another plain text editor again & paste what you just copied into a blank document. Save as footer.php. Be sure to pick "all files" from the Save as Type dropdown box, not "text documents (.txt)"
4. Last step(; Yay, now go and open & strip all of your pages. Get rid of the layout code. The only thing left in each page besides your footer & header pages, is just the content. Than add <?php include('header.php'); ?> above your content, & <?php include('footer.php'); ?> below your content.
Look at how simple each of your pages are now! You now only have to put the inlcude codes & type your content in each page. Isn't that great! :D Finally, save and re-upload all of your files. Next time you want to add something to all pages or change the layout you just have to change the header and footer files & every pages will change, if you did it correctly.
(Note: the page should look the same, and so will the source!)
The Purpose: You know when you want to change your site layout, or want to add something to your side/menu bar and you really don't want to go though each file/page to change it to match all the other pages? This could take a long time and effort to do this. Well, now you don't have to! Yay, just follow the rest of this tutorial.
1. If your site is completely coded in .html like for example all your pages are, index.html, content.html, ect, you have to go though each file and change the page extention to .php, like index.php, content.php, ect. Every page has the same exact coding, but different content, right?
2. Now, were going to create a header.php file. Open one of your files. Copy everything above your content for that page. Open Notepad 0r another plain text editor. Paste what you just copied into a blank document. Save as header.php. Be sure to pick "all files" from the Save as Type dropdown box, not "text documents (.txt)"
3. Now, were going to create a footer.php file. Again, open one of your files. Now, copy everything below your content for that page. Use Notepad 0r another plain text editor again & paste what you just copied into a blank document. Save as footer.php. Be sure to pick "all files" from the Save as Type dropdown box, not "text documents (.txt)"
4. Last step(; Yay, now go and open & strip all of your pages. Get rid of the layout code. The only thing left in each page besides your footer & header pages, is just the content. Than add <?php include('header.php'); ?> above your content, & <?php include('footer.php'); ?> below your content.
Look at how simple each of your pages are now! You now only have to put the inlcude codes & type your content in each page. Isn't that great! :D Finally, save and re-upload all of your files. Next time you want to add something to all pages or change the layout you just have to change the header and footer files & every pages will change, if you did it correctly.
(Note: the page should look the same, and so will the source!)