Example #1
0
 /**
  * Runs the application
  *
  * This method accepts an array of values, typically the $_SERVER superglobal,
  * and creates a router to parse the array. Boilerplate start and end HTML
  * is called in, and the router is despatched to fetch the correct controller
  * and view files and display the right data.
  *
  * @param $initArray the array holding data for the router
  * @return void
  *
  */
 public function runApp($initArray)
 {
     // Get new Router and despatch request to correct scripts
     $router = new Router($initArray);
     // Start output buffering
     ob_start();
     // Set up the top-of-page boilerplate stuff
     include '../views/startPage.php';
     // Despatch the router to parse the URL and load the correct controller
     $router->despatchRequest();
     // Close down the HTML for the page and flush all output to the browser
     include '../views/endPage.php';
     ob_end_flush();
 }