This commit is contained in:
Bruno Rybársky 2024-02-06 16:28:36 +01:00
parent 72bd8b8bd1
commit 6c1f6b1571
2 changed files with 3 additions and 2 deletions

@ -18,7 +18,7 @@ function getEndpoint($endpoint_name): string
global $routerRequest;
if(!$endpoint_name){
$endpoint_name = $routerRequest["page_name"];
$endpoint_name = $routerRequest["site_name"];
}
$endpoint_file = $routerConfig["endpoint_dir"] . $endpoint_name . ".php";
@ -27,7 +27,7 @@ function getEndpoint($endpoint_name): string
$output = runEndpoint($endpoint_file);
}
else{
$output["error"] = "Not found";
$output["Error"] = "Not found";
http_response_code(404);
}

@ -11,6 +11,7 @@ function initRouter(): array
$request_uri = explode("/", $_SERVER["QUERY_STRING"]);
$request_uri = array_slice($request_uri, -3, 3);
print_r($request_uri);
$routerRequest["site_name"] = basename($request_uri[1]);
$routerRequest["page_name"] = basename($request_uri[2]);