It looks like you've gotten a few very good replies. I thought I'd show you how I handle the process you're talking about.
The following code is my index.php, I'll do my best to explain what the code is doing, it's really pretty simple.
PHP Code:
<?php
session_start(); //Initialize a PHP session
include 'includes/functions.php'; //Include some custom functions for the site
av_init(); //This initiates some common variables including template paths, and scans the users IP against my BAN list
include $tpl_path . 'header.php'; //$tpl_path is the path of the current template for the website.
include $tpl_path . 'navbar.php'; //I am including this templates header and navigation bar
insert_banner(0, 'center'); //another custom function to insert a random banner from a list in a MySQL table
echo '<br><br>';
/**** HERE IS THE MEAT OF THE CODE ****/
$page = $_GET['page'];
switch ($page) {
case 'viewprofile':
include $tpl_path . 'profile.php';
break;
case 'status':
include $tpl_path . 'server.php';
break;
case 'csphotos':
include $tpl_path . 'oops.php';
break;
case 'apply':
include $tpl_path . 'recrute.php';
break;
case 'contactus':
include $tpl_path . 'contactus.php';
break;
case 'process':
include 'includes/process_recrute.php';
include $tpl_path . 'application_complete.php';
break;
case 'lan2005':
include $tpl_path . 'lan2005.php';
break;
case 'mail_form';
include $tpl_path . 'mail_form.php';
break;
case 'sendmail';
include 'includes/sendmail.php';
include $tpl_path . 'email_complete.php';
break;
default:
insert_news(5, 500, 15);
}
include $tpl_path . 'footer.php';
?>
In the "MEAT" of the code, you'll see I take the "page" URL variable and enter it into a "SWITCH" statement. I use that "page" variable to include the requested content. Doing this I am able to create unlimited numbers of pages without having to copy/paste the same headers and footers over and over. Every page on my website runs through index.php. I realise now that I can save a lot of lines of code by setting the page value to the actual filename and running that through one simple expression, though that wouldn't allow me to run page specific routines when needed, like when $page = process/sendmail