-
Notifications
You must be signed in to change notification settings - Fork 310
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
Pass more than one parameter #64
Comments
You can have as many variables as you like in a route. You can then get them in the route_params property. For example:
Then in the action:
Is that what you meant? |
Could you not pass an array? |
that's what I meant, thank you very much |
I'm afraid not, that's not how the framework works at the moment with parameters. |
Hi @daveh will it be possible with the new version? Many thanks |
@vince844 I'm not sure what you mean - each URL segment (e.g. /segment1/segment2 etc.) can correspond to a variable, so you could have something like this: /users/123/orders/345/product-1 and so on. As the URL is a string, each segment can only ever be a simple string too. If you want several values, then just have several route variables / segments. |
I want to update the data .So I tried to pass it with the traditional system of php (i.e list?id=1)...than i am not able to get this id by using $_GET method. |
If you're updating data, you should really be using POST. If you have values in a form using the POST method, you can get them in the |
I have this route: $router->add("product/{id}/{slug}","ProductController@index"); I always pass id but slug is optional |
@mosafer72 You can't do that with a single route in this framework, you'd have to add two routes:
Plus, the controller and action are specified as individual array elements above, not as in your example (unless you've modified the router) |
Take a look at this pull request #73 to allow one or more parameters, without need to create a route for every method. I think can be useful for most simple requests. |
I know it is possible for me to pass a parameter to an action as follows:
$router->add('{controller}/{action}/{id:\d+}');
public function indexAction() { View::renderTemplate('Sobre/index.html'); }
But how can i pass, two or more parms to the router and get there parms into the action.
Sorry my bad english.
The text was updated successfully, but these errors were encountered: