You don't need a database, that was just an extra tidbit in case you were pulling from mysql.
So, lets assume you have some links on the page that hold the name of the page they are supposed to load such as "index.php?page=contact".
looking at the code:
First we check to see if the user has clicked a link that will include a file.
//check for page link
if(isset($_GET[page])){
//set the page name to a variable.
$page = $_GET[page];
}else{
//set the page name to a default variable (somethign that will just include index.php)
$page = 'default';
}
This bit is where we associate the name (?page=contact) with an actual file. The switch will compare the variable $page (which equals contact in our example) with each case untill it matches, or use the default case.
switch($page){
case 'home':
$page_include = 'main/home.php';
break;
case 'contact':
$page_include = 'contact/contactus.php';
break;
case default:
$page_include = 'main/home.php';
break;
}
So if we clicked the contact us link, and set the $page to contact, then the switch would set $page_include to 'contact/contactus.php', this is the path to the file (can be text file, so the file could be contactus.txt).
Now all that is left to do is include that file in our document.
//then just include it by the path.
include($page_include);
Still confusing?