Reputation: 13
i have got a little problem in my auraphp router. For example i have this URL : oleje/134/motorove-oleje-pro-automobily/
But i can have this URl also : oleje/134/motorove-oleje-pro-automobily/oleje-shell
The "oleje-shell" part of URL is optional and i need to put behind this part one more optional parameter called "per_page". So i need something like : oleje/134/motorove-oleje-pro-automobily/35 or : oleje/134/motorove-oleje-pro-automobily/oleje-shell/35.
I hope, you got it.
Thanks for help.
Upvotes: 0
Views: 228
Reputation: 4244
2 options are coming to my mind.
$router->add('archive', '/oleje/134/motorove-oleje-pro-automobily{/oleje,number}');
$router->add('wild_post', '/oleje/134/motorove-oleje-pro-automobily/') ->setWildcard('other');
// this matches, with the following values $route = $router->match('/oleje/134/motorove-oleje-pro-automobily/oleje-shell/35', $_SERVER); // $route->params['other'] = array('oleje-shell', '35')
In both cases you may want to check whether the one you got is string or number.
Hope that help!
Upvotes: 1