` or `` tags. Those are provided by the header and footer // templates. $pageMap = [ '' => 'pages/home.php', 'home' => 'pages/home.php', 'projects' => 'pages/projects.php', 'contact' => 'pages/contact.php', ]; // Determine the file to include based on the slug. Unknown slugs result in // a 404 status but fall back to the home page content. if (array_key_exists($slug, $pageMap)) { $contentFile = $pageMap[$slug]; } else { http_response_code(404); $contentFile = 'pages/home.php'; // Adjust slug so that templates know the current page for asset loading $slug = 'home'; } // Include the header template. It expects `$title` and `$slug` variables // (which may be defined in the page file) but will still render if they // aren't set. `$slug` is passed explicitly to the header for conditional // asset loading (e.g. Leaflet on the contact page). require 'templates/header.php'; // Include the requested content file if it exists; otherwise display a basic // error message. The page file should set `$title` and `$slug` as needed. if (file_exists($contentFile)) { include $contentFile; } else { http_response_code(404); echo '

Page not found

'; } // Include the footer template. The footer uses `$slug` to load page‑specific // scripts (Leaflet for the contact page) and outputs the current year. require 'templates/footer.php';