Always include nav.html

This commit is contained in:
Bruno Rybársky 2024-02-05 22:26:02 +01:00
parent 89d5cccc31
commit 2cade060cf
2 changed files with 5 additions and 5 deletions

@ -22,6 +22,7 @@ function generateNavigation(): string
global $routerConfig;
global $routerRequest;
$nav = file_get_contents($routerConfig["template_dir"] . "nav.html");
$site_dirs = array_diff(scandir($routerConfig["page_dir"]), array('.', '..'));
$nav_out = "";
@ -92,7 +93,7 @@ function generateNavigation(): string
}
}
return $nav_out;
return str_replace("__NAV_PAGES__", $nav_out, $nav);
}
function getNavigationEndpoint() :array{

@ -127,7 +127,7 @@ function getPage($page_name_in = null, $site_name_in = null): string
global $routerConfig;
$skeleton = file_get_contents($routerConfig["template_dir"] . "skeleton.html");
$nav = file_get_contents($routerConfig["template_dir"] . "nav.html");
if(!empty($pageMetadata["parameters"]["page_title"])){
$page_title = $pageMetadata["parameters"]["page_title"];
}
@ -141,12 +141,11 @@ function getPage($page_name_in = null, $site_name_in = null): string
"currentTitle" => $page_title,
"defaultPage" => $routerConfig["default_page"],
]);
$navpages = generateNavigation();
$nav = str_replace("__NAV_PAGES__", $navpages, $nav);
$out = $skeleton;
$out = str_replace("__TEMPLATE__NAV__", $nav, $out);
$out = str_replace("__TEMPLATE__NAV__", $navpages, $out);
$out = str_replace("__TEMPLATE__PAGE__", $page, $out);
$out = str_replace("__TEMPLATE__DYNASCRIPT__", $dynamic_script, $out);
$out = str_replace("__TEMPLATE__DYNASTYLE__", $dynamic_style, $out);