Quality web site hosting for personal and business web sites
Home Web Hosting Plans Support About Contact Order Now

referral program

30 day money back guarantee

free setup

Home >> Support >> Articles >> Including Files in PHP

Including a file into another php file is a great way to save many hours when building web sites. In this tutorial we will create a header and footer which can be easily included into any other php file.

Create the Files

Using your default HTML/PHP editor create the following files.
index.php header.php footer.php
Now edit header.php adding the following contents.
<h1>This is the header</h1>
And edit footer.php adding the following contents.
<h3>This is the footer</h3>
Including the Header and Footer

Now, we have created the header and footer. So all we have to do is edit our index file and add the php include statements.
<? include "header.php"; ?>

<h3>This is the index</h3>

<? include "footer.php"; ?>
Conclusion

Your all done. Now you can expand your site by including the header and footer files into other pages of your web site like a contact us, about us and any other content pages.


Web Hosting Plans / Web Hosting Support / Site Map
4d Web Hosting © 1997 - 2008

Member's Area Login | WebMail Login