diff --git a/index.php b/index.php index df030a1..0273e43 100644 --- a/index.php +++ b/index.php @@ -32,15 +32,6 @@ if (empty($page_name)){ session_set_cookie_params(0, '/', ".$domain.$tld", true, true); session_start(); -$navpages = generateNavigation($static_page_dir, $protocol, $subdomain, $domain, $tld, $default_page, $page_name); - -$nav = str_replace("__NAV_PAGES__", $navpages, $nav); - -$out = $skeleton; -$out = str_replace("__TEMPLATE__NAV__", $nav, $out); -$out = str_replace("__TEMPLATE__PAGE__", $page, $out); -$out = str_replace("__TEMPLATE_PAGE_NAME__", $page_name, $out); - -echo $out; +echo getPage($routerConfig); ?> \ No newline at end of file diff --git a/lib/routing.php b/lib/routing.php index fbf1bf3..bcf7587 100644 --- a/lib/routing.php +++ b/lib/routing.php @@ -9,7 +9,7 @@ function getProtocol(){ } function getPage($routerConfig){ - $page_dir = $routerConfig['page_dir']; + $page_dir = "pages/"; $dynamic_page_file = $page_dir . $subdomain . "/" . $page_name . ".php"; $page_file = $page_dir . $subdomain . "/" . $page_name . ".html"; @@ -34,7 +34,16 @@ function getPage($routerConfig){ } else{ $page = file_get_contents($template_dir . "404.html"); -} + } + $navpages = generateNavigation($static_page_dir, $protocol, $subdomain, $domain, $tld, $default_page, $page_name); + + $nav = str_replace("__NAV_PAGES__", $navpages, $nav); + + $out = $skeleton; + $out = str_replace("__TEMPLATE__NAV__", $nav, $out); + $out = str_replace("__TEMPLATE__PAGE__", $page, $out); + $out = str_replace("__TEMPLATE_PAGE_NAME__", $page_name, $out); + return $out; } ?> \ No newline at end of file