case "Dates": $c = new DateController(); break; case "Comment": $c = new CommentController(); break; case "User": $c = new UserController(); break; case "Mensen": $c = new MensaController(); break; case "Menus": $c = new MenusController(); break; default: throw new Exception('Unkown Parameter!'); break; } } else { if (empty($_POST)) { throw new Exception('Missing Parameters!'); } else { throw new Exception('Missing Parameters!'); } } $c->handleRequest($_POST['type'], $jsondata); } catch (Exception $e) { // Display the error page using the "render()" helper function: render('error', array('message' => $e->getMessage())); }