i've got this script which i am trying to put on my site, but i do not understand what document root is? sorry to sound such a noob
right index.php, the file i am trying to call pages from a folder called test is using 'test/' the right thing to be doing, it's not to much of a big deal, as i can just add test/ to all the links.
but i was just wondering what the document root was for and have i totally set it up wrong
<?php
# default page
$default = 'test/home.php';
# set document root path
$base = $_SERVER['test/'];
# list of all site pages + the id they will be called by
$pages = array('home' => 'test/home.php','profile' => 'test/profile.php','portfolio' => 'test/portfolio.php','forum' => 'test/forum.php','contact' => 'test/contact.php','calender' => 'test/calender.php');
if(array_key_exists($_GET['page'], $pages))
{
foreach($pages as $pageid => $pagename) {
if($_GET['page'] == $pageid && file_exists($base.$pagename))
{
/* if somebody's making a request for ?page=xxx and
the page exists in the $pages array, we display it
checking first it also exists as a page on the server */
include $base.$pagename;
}
} // end foreach
}
else {
/* if the page isn't listed in $pages, or there's no ?page=xxx request
we show the default page, again we'll also just make sure it exists as a file
on the server */
if(file_exists($base.$default)) include $base.$default;
}
?>