Poll:
How old are you?
10 - 20 years
20 - 30 years
30 - 40 years
40 - 50 years

The glory of php include( )

Let me tell you a little bit about the php include statement and how it can make your life as a webmaster a little bit easier. If you have a website with many pages you have probably had this problem: one little thing needed to be changed on all of your web pages. This could be a menu-item that had to be added or changed or a simple text change in the footer of your page. When you are only using html to create your pages you probably had to open each page of your website seperately to make the change. On a small website this isn't really a big problem, but what if you need to change the footer text on hundreds of pages...

One thing you learn when programming is that any action or data, that is needed in different parts of your program, should not be coded into the program several times, but rather be coded once and then be invoked from the different parts of the program when needed. When this needs to be done in a program, you will usualy turn the piece of code, that is needed in different places in the program, into a function or you store it as a sepperate little program and call it from within your main program.

The piece of code you want to re-use can be a full-blown script, html code or just plain text. My first use of the php include statement was to store website headers, menus and footers into sepperate files, so any updates needed would only have to be done once to affect every page on the whole website.

An introduction to php

All the scripts for download on this website come with a step by step tutorial from initial idea right down to a working script. Before getting down to programming scripts, there are a few basic things you should know about the php scripting language.

To get you started on php programming you will find a few basic lessons here

currently 2 visitors online