Hostess

Synthoxide

Main Menu

Clear About Awards Credits Joined Contests Linkage Taggie

Contest

Current Rules Entry Form Contestants Past Winners

Graphics

TOS 100x100 Icons Brushes Designs Textures Wallpapers

Icons Resource

Bases Textures Tutorials

Tutorials

HTML PHP Photoshop Other


eXTReMe Tracker

PHP Includes Tutorial Intro

This tutorial will teach you all about PHP includes. This is very helpful if you have multiple pages. You can use PHP includes for changing layouts with ease, or making a small change that applies to all pages. Now let us commence! =)

PHP Includes Tutorial

1. Open up 2 new text documents. Name one header.php and the other footer.php. You must remember to add the extension .php or it won't work.

2. Open up your index page and copy everything up to your content and paste it all in header.php. That means even your div positioning right before the content. This means all this stuff will be the same for every page of your site. Save.

3. Do the same to your footer.php, except put all your ending tags in there, such as </div>, </body>, and </html> only. Save.

4. So now your index page should only have your content, and nothing else. Now to the includes. So you have your 3 pages, index, header, and footer. In your index page, on top of your content add this:

<? include("/home/user/public_html/folder/header.php"); ?>

Change "user" to the username. If you're hosted on a domain, ask your host for the username. Change "folder" to the folder that you keep all your files. Usually it would be your own username.

5. Lastly, add:

<? include("/home/user/public_html/folder/footer.php"); ?>

making the same changes as the header. Paste this at the very end of your document, which would be after all your content.

6. Do steps 2-5 to all your pages, changing the extension to .php if your extensions are .html. After all your pages have been changed, upload everything, including the header and footer. Now, when you want to change your layout or make a change, go to header.php and change it there. It will apply to all your pages. And if you look at your source code, it still says the whole code without the PHP.

Final Note

I hope this tutorial helped you lots! I worked hard writing this tutorial, so I would appreciate it if you provided a link back to me if it helped you in any way. If you have any questions about this tutorial, don't hesitiate to email me.







Aureus and all content © 2004-2007 to Celes. All Rights Reserved. No part of this site may be duplicated, altered, claimed, sold, changed, or in any way or form without permission from the owner. You may view the credits here. Thank you so much Chie for hosting me!