Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
WKnak wants to merge 1 commit into daveh:master from WKnak:feature/multiple-parameters

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
edited
Loading

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.

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!

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

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!

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 reacted with thumbs up emoji

@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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /