Last active
February 15, 2016 16:19
-
-
Save johanbrook/f4810c43412205adffed to your computer and use it in GitHub Desktop.
Revisions
-
johanbrook revised this gist
Feb 15, 2016 . 1 changed file with 9 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,14 @@ <?php $page = $_GET['page']; $map = [ 'about' => 'about.php'; ]; $file = $map[$page]; # Fallback if(!$file) { $file = 'home.php'; } ?> <!doctype html> -
johanbrook created this gist
Feb 15, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php $page = $_GET['page']; $file = 'home.php'; switch($page) { case 'about': $file = 'about.php'; break; default: $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>