Skip to content

Instantly share code, notes, and snippets.

@teddykishi
Created March 19, 2018 12:46
Show Gist options
  • Save teddykishi/542029877fd1945cbe9da6c045974104 to your computer and use it in GitHub Desktop.
Save teddykishi/542029877fd1945cbe9da6c045974104 to your computer and use it in GitHub Desktop.
Index page of php
<?php
// display errors
error_reporting(E_ALL);
ini_set('display_errors', 1);
include "tools.php";
// Router
if( isset($_GET["page"]) && !empty($_GET["page"]) ){
switch($_GET["page"]){
case "contact": // load the contact page
$view = "view_contact.php";
include "controller/controller_contact.php";
break;
case "article": // load the contact page
$view = "view_article.php";
include "controller/controller_article.php";
break;
default:
// home page
$view = "view_home.php";
include "controller/controller_home.php";
}
} else {
$view = "view_home.php";
include "controller/controller_home.php";
}
// Controller
// Model
// Render the View
include "view/partials/view_header.php";
include "view/pages/".$view;
include "view/partials/view_footer.php";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment