From f219adfa5f7db8c5f36d12448113c0918dc1db72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Tue, 16 Jan 2024 19:38:42 +0100 Subject: [PATCH] fix --- index.php | 11 +---------- lib/routing.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 12 deletions(-) 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