PHP Includes


PHP includes are often used in DIV layouts, so that you can edit just one page (example being your sidebar) and it will show up on every page. This way you don't have to have all your sidebar information on every single page, just because you want to have a DIV style layout instead of an iframe.


Simply place this code where your sidebar is going to be, and make sure you link to the URL of your sidebar page. Make sure you are using the .php extension, otherwise this will not work!

<? include("YOURSIDEBAR.php"); ?>


I've recently discovered that some hosts do not allow you to link to outside pages using the code above, (such as my host) so if you want to link to one of your other pages, that is in a separate directory, you'll need to use this code instead.

<? $a = file_get_contents("http://www.URL_OF_YOUR_SIDEBAR.php"); echo ($a); ?>






eXTReMe Tracker