© Websitename 2011
<a href='contact.php'>Contact Page</a>
Created by <a href='mailto:email@example.com'>me</a>
Save the above code as footer.php.
Now save the below code as index.php. Make sure they are in the same directory though, since our index page will only be looking in the directory it's in.
This is my page:
<? include("footer.php"); ?>
Now upload both footer.php and index.php, and load index.php in your browser.
Pretty cool huh? Add that little include command into your web sites, and you'll save yourself a lot of time.
It also works with variables instead of a string.
$footer = "footer.php";
What does the page source look like?
...Like it was always a single file page.
Create a new file you want to be included in your page, call it include_this.php
Create index.php, and add regular text or HTML like your normally would, but also use the include command to add include_this.php to your page.