function __construct() { $sesion = new Sesion('usuario'); $router = new Router(); $router->AppRoutes(); $router->View($sesion); }
<?php defined('ROUTER_ACCESS') or die('No direct script access.'); // new panel $p = new Router(); // home $p->Route('/', function () use($p) { // get database $d = $p->Db('db'); // get home $data = $d['home']; // get View $p->View('index', ['title' => $data['title'], 'content' => $data['content']]); }); // other $p->Route('(:any)', function ($name) use($p) { // get database $d = $p->Db('db'); // empty name if (isset($d[$name])) { // get home $data = $d[$name]; // get View $p->View('index', ['title' => $data['title'], 'content' => $data['content']]); } else { $p->View('error', ['title' => 'Error 404', 'content' => "We're sorry but the page you are looking for doesn't appear to exist!"]); } }); // start $p->launch();