*/ $url = $_GET['url']; $url_count = strlen($url); $slug_number = 1; $slug = array(); for ($i = 0; $i <= $url_count; $i++) { $letter = substr($url, $i, 1); if ($letter == '/' || $letter == '') { $slug_number++; } else { $slug[$slug_number] .= $letter; } } /* * This section decides wether the user is requesting the homepage or another page. * It does this by checking wether slug 1 is defined, if not then it will load the * home page. * * If the root slug is defined then it will decide what file to load by accessing * the page data and getting a file URL. * */ if (!isset($slug[1])) { include $_SERVER['DOCUMENT_ROOT'] . $INS_DIR . 'themes/' . getTheme() . '/home-page.php'; } else { if (slugActive($slug[1])) { include getSlugLocation($slug[1]); } else { include $_SERVER['DOCUMENT_ROOT'] . $INS_DIR . 'themes/' . getTheme() . '/404.php'; } }
function getSlugLocation($slug) { global $active_slugs; if (slugActive($slug)) { return $active_slugs[$slug][0]; } else { return false; } }