MayfieldGlobal

Everything from operating systems, programming to web development and more.

Jan
19

How do I use PHP includes in my Web pages?

Posted under PHP

PHP Includes allow you to easily reuse specific sections of code and content throughout your site. For example, many sites have a footer section where they display additional navigation links, ads, etc. Without PHP Includes (or other server side programming language), a developer would need to write the same code for this footer into each and every page of their site. Manually coding every page with the same identical content is a serious hassle and can make maintenance a nightmare. In comes PHP includes.

A basic include statement is written like this:<?php include ( 'directory/filename.php' ); ?>

Pretty simple. Now, let’s say you want the links listed below to be displayed as the footer in several pages of your site:
Read the rest of this entry »