Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Last active February 15, 2016 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanbrook/f4810c43412205adffed to your computer and use it in GitHub Desktop.
Save johanbrook/f4810c43412205adffed to your computer and use it in GitHub Desktop.
<?php
$page = $_GET['page'];
$map = [
'about' => 'about.php';
];
$file = $map[$page];
# Fallback
if(!$file) {
$file = 'home.php';
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Header</h1>
</header>
<main>
<?php include $file; ?>
</main>
<footer>
<p>Footer</p>
</footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment