When you have in router variable 'pass' it appears twice. (i don't know if it's a bug or a feature) $this->params[pass'][] and $this->paramas['location'] I removed array 'pass' from Router::connect and urls are fine now, but I need to get variables from $this->params in controller. Perhaps there is better solution.
On Oct 19, 4:07 pm, "Daehee Park" <dae...@gmail.com> wrote: > Nice, now the links actually are clickable and route to the correct > pagination view. But the link still looks like this: > > http://localhost/test/newyorkcity/spots/newyorkcity/page:2 > > So using the options() in the paginationhelper is passing it twice to the > controller? If I *don't* use the options, however, the location is only > passed once through the url formatting but the links are no longer > clickable. > > For reference, here are my changes as suggested by Mathew: > > <?php $paginator->options(array('url' => array('location' => > $this->params['location']))); ?> > > Router::connect('/:location/spots/*', array('controller' => 'spots', > 'action' => 'index'), array('pass' => array('location'), 'location' => > '[a-z]+')); > > On Sun, Oct 19, 2008 at 8:48 AM, Mathew <nfoscar...@yahoo.com> wrote: > > > > Router::connect('/:location/spots/:page', array('controller' => > > > 'spots', 'action' => 'index'), array('pass' => array('location'), > > > 'location' => '[a-z]+')); > > > Your router should be like this. > > > Router::connect('/:location/spots/*, array('controller' =>'spots', > > 'action' => 'index'), array('pass' => array('location'),'location' => > > '[a-z]+')); > > > You also need to add the location as an option for pagination in your > > view. So that it includes it when creating the URLs. > > > $paginator->options(array('url' =>array('location'=>$this- > > >params['location]))); > > > If you don't have the location added as an option, then the Router > > will not match it to your URL pattern, and you need to have the wild > > character at the end of your connect URL, because pagination generates > > many types of parameters. Such as page, sorting, and field. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---