<?php 
	
# index.php

/* 
 *	This is the main page.
 *	This page includes the configuration file, 
 *	the templates, and any content-specific modules.
 */

// Require the configuration file before any PHP code:
require_once ('../config.inc.php');
	


// Validate what page to show:
if (isset($_GET['p'])) {
	$p = $_GET['p'];
} elseif (isset($_POST['p'])) { // Forms
	$p = $_POST['p'];
} else {
	$p = NULL;
}

// Determine what page to display:
switch ($p) {
	
	/*%BEGIN CASELIST%*/

	case 'aboutme':
		$page = 'aboutme.inc.php';
		$page_title = 'About Me';
		$page_name = 'About Me';
		break;

	case 'blog':
		$page = 'blog.inc.php';
		$page_title = 'Blog';
		$page_name = 'Blog';
		break;


	/*%END CASELIST%*/
		
	// Default is to include the main page.
	default:
		$page = 'home.inc.php';
		$page_title = 'Home';
		$page_name = 'Home';
		break;
		
} // End of main switch.

// Make sure the file exists:
if (!file_exists('modules/' . $page)) {
	$page = 'home.inc.php';
	$page_title = 'Home';
}

$page_title='Demo Site - '.$page_title;

// Include the header file:
include_once ('includes/header.inc.php');

// Include the content-specific module:
// $page is determined from the above switch.
include ('modules/' . $page);

// Include the footer file to complete the template:
include_once ('includes/footer.inc.php');

?>
