I would like to define a url like below:
http://localhost/bekzcart/books/list?cid=1&type=grid&page=1
How to create a custom route for that type of url, my router code is not work at all
Router::connect('/books/list?cid=:cid&type=:type&page=:page', array('controller' => 'books', 'action' => 'list'));
The parameter cid, type, and page is empty, but when i changed to
Router::connect('/books/list?:cid&:type&:page', array('controller' => 'books', 'action' => 'list'));
it works, the parameter cid, type, and page is now exist.
Note: my cake version is 1.3
Thanks in advance,
Brian
I don’t think you need those routes, if you need to get those url parameters, you can just get it from
$this->params['url']['param_name']If you want the parameters to be readily available as ${param_name} in your method, you can tell routes to pass those params by using pass, like so:
http://book.cakephp.org/view/949/Passing-parameters-to-action
So in your case, would be something like: (untested)