-
Couldn't load subscription status.
- Fork 312
Created generic handler for routes with one or more parameters #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Created a generic handler for one or more parameters to avoid need to create each method a route in the application. Need to check for security (special characters).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it was created a generic route to {controller} without action, when it happens so it will call indexAction by default.
Thank you for the pull request @WKnak - I'll look into it. At the moment though I'm working on a major update that will change the way the framework works, so I'll take a look at your code but I don't want to update this version of the framework at the moment. Thanks!
jackttcoms
commented
Dec 2, 2020
Ooooo I look forward to this major update. Any idea when it's gonna be available/if it is available somewhere else to see? Thanks :)
@jackttcoms sorry no idea at the moment when it'll be available (current situation affecting things a bit!) - as soon as I can though!
Rasalas
commented
Apr 16, 2022
can't we add a generic route like this?
# /public/index.php - - - - - - - - - - /** * Routing */ $router = new Core\Router(); // ... // generic route -> "example.com/item" routes to "App\Item\indexAction" $router->add('{controller}', ['action' => 'index']); // ... $router->dispatch($_SERVER['QUERY_STRING']);
Passing through arguments to the controller functions like this is a nice idea though.
Twig escapes them when it echos them into/onto your page so I don't see a problem there
Created a generic handler for one or more parameters to avoid need to create each method a route in the application. Need to check for security (special characters).