addGlobal('config', $config); require(__DIR__ . "/../app/View.php"); $router = new AltoRouter(); $router->setBasePath(''); $router->map('GET','/', "App\Controllers\HomeController#index", 'home'); $router->map('GET|POST','/upload', "App\Controllers\HomeController#upload", 'upload'); $router->map('GET|POST','/printt', "App\Controllers\HomeController#print", 'print'); $match = $router->match(); list( $controller, $action ) = explode( '#', $match['target'] ); if ( is_callable(array($controller, $action)) ) { $obj = new $controller($twig); call_user_func_array(array($obj,$action), array($match['params'])); } else if ($match['target']==''){ echo 'Error: no route was matched'; //possibly throw a 404 error } else { echo 'Error: can not call '.$controller.'#'.$action; //possibly throw a 404 error }