prepare($query)) { $stmt->execute(); $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { $module = $row['module_slugify']; $pages[$module][$row['page_name']] = $row; } $stmt->close(); } $GLOBALS['pages'] = $pages; $this->figureOutContent(); } private function figureOutContent() { $requestUri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); // Remove trailing slash, but only if it’s not the root "/" if ($requestUri !== '/' && substr($requestUri, -1) === '/') { $requestUri = rtrim($requestUri, '/'); } $GLOBALS['breadCrumbArray'] = array(array('display' => '', 'href' => '/')); $GLOBALS['pageContentToShow']['pageName'] = '404'; $GLOBALS['pageContentToShow']['pageFile'] = 'pageNotFound.php'; $GLOBALS['pageContentToShow']['pageIcon'] = ''; $GLOBALS['pageContentToShow']['noUsersAllowed'] = false; foreach ($GLOBALS['pages'] as $module) { foreach ($module as $page) { if ($requestUri == $page['page_url']) { $GLOBALS['pageContentToShow']['pageName'] = $page['page_name']; $GLOBALS['pageContentToShow']['pageFile'] = $page['page_location']; $GLOBALS['pageContentToShow']['pageIcon'] = ''; $GLOBALS['pageContentToShow']['noUsersAllowed'] = false; } } } } public function buildPage() { ?> pageHeadContent(); ?>
pageScriptContents(); ?>