Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

WKnak
Copy link

@WKnak WKnak commented Nov 19, 2020

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).

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).
Copy link
Author

@WKnak WKnak left a 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.

@daveh
Copy link
Owner

daveh commented Nov 19, 2020

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
Copy link

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 :)

@daveh
Copy link
Owner

daveh commented Dec 2, 2020

@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
Copy link

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

@daveh daveh closed this May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants