if ($method == 'get') { switch ($uri) { case "/": $frontController = new FrontController(); $frontController->index(); break; case preg_match('/\\/product\\/([1-9][0-9]*)/', $uri, $m) == 1: $front = new Controllers\FrontController(); $front->show($m[1]); break; case "/cart": $front = new Controllers\FrontController(); $front->showCart(); break; case "/store": $front = new Controllers\FrontController(); $front->store(); break; default: $message = 'Page Not Found'; view('404', compact('message')); } } if ($method == 'post') { switch ($uri) { case '/command': $front = new Controllers\FrontController(); $front->command(); break; } }
$front->Show($m[1]); break; // catégories // catégories case preg_match('/\\/category\\/([1-9][0-9]*)/', $uri, $m) == 1: $frontController = new Controllers\FrontController(); $frontController->showCategory($m[1]); break; /* formulaire */ /* formulaire */ case "/cart": $frontController = new Controllers\FrontController(); $frontController->showCart(); break; default: $message = 'Page Not Found'; view('front.404', compact('message'), '404 Not Found'); } } if ($method == 'post') { switch ($uri) { case "/command": $frontController = new Controllers\FrontController(); $frontController->command(); break; case "/store": $frontController = new Controllers\FrontController(); $frontController->store(); break; } }