function __construct()
 {
     parent::__construct(array('@^admin\\b@' => function () {
         if (!$loggedIn) {
             header('Location: ' . Route::getFrontControllerPath() . '/login');
             exit;
         }
         // Return false, so the next route is also evaluated.
         return false;
     }, '@^admin$@' => 'showAdminIndex'));
 }
 protected function index()
 {
     die("<a href='" . Route::getFrontControllerPath() . "/customers'>Show customers</a><br>\n        <a href='" . Route::getFrontControllerPath() . "/customers/12'>Edit customer 12</a><br>\n        <form method='post' action='" . Route::getFrontControllerPath() . "/customers/12'><input type='submit' value='Update customer 12' /></form><br>\n        <a href='" . Route::getFrontControllerPath() . "/customers/12/orders'>Show orders from customer</a>");
 }
Example #3
0
<?php

use PHPMICROLIB\Router\Route;
?>
<!doctype html>
<html>
  <head>
    <title><?php 
echo $this->esc($title);
?>
</title>
    <link rel="stylesheet" href="<?php 
echo Route::getFrontControllerPath();
?>
/css/app.css">
  </head>
  <body>
    <?php 
if (!empty($exception)) {
    ?>
    <div class="error"><?php 
    echo $this->esc($exception);
    ?>
</div>
    <?php 
}
?>
    <?php 
echo $content;
?>
  </body>
 protected function index()
 {
     die("<a href='" . Route::getFrontControllerPath() . "/about/12'>About...</a>");
 }