views:

49

answers:

1

I'm setting up a search system which has urls eg. all parameters are optional and there are 15 possible params in total

http://example.com/search/key1-value/key2-value/key3-value/key13-value/key15-value

Is there a better way to set up the route than this?

Route::set('search', 'search(/<param1>(/<param2>(/<param3>(/<param4>(/<param5>(/<param6>(/<param7>(/<param8>(/<param9>(/<param10>(/<param11>(/<param12>(/<param13>(/<param14>(/<param15>)))))))))))))))')
        ->defaults(array(
        'controller' => 'search',
        'action'     => 'index',
));

I would then test for them in the controller and parse them to a neat array. Is there any way to specify a route with any number of optional /key-value/ parameters?


EDIT

I noticed the request object has a nice parameter array already -- this leads me back to the Route::set question.. is there a way to phrase it allowing any number of parameters without the ugly ...(/<param14>(/<param15>))))))))... nesting?

+1  A: 

No.

PS: someone can say again that short answers are bad, but there is nothing to say more: No, there is no such way.

zerkms
yup. That's what I thought. Ahh well, once I discovered the Request::param() function it didn't really matter anymore *shrug*
FelixHCat