In my site, I'm using the following type of URL to include one page inside the main template:
Code: Select all
http://mysite/index.php?page=mypageMy code to handle these requests is as follows:
Code: Select all
if (empty($_GET['page'])) {
//Set a default page if it is not explicitly requested
$page = 'home';
}
else {
//Otherwise, assign it to the variable.
$page = $_GET['page'];
}
//Retrieve the specified page from the directory
$displaypage = @include('../system/pages/'. $page .'.php');
//If the page does not exist, throw an error
if (!$displaypage) {
@include('../system/pages/custerror/404.htm');
exit;
}Any insight is greatly appreciated.