Monday, March 1, 2010

Pagination and named parameters - routing

Hello,

Have problem with named parameters in pagination.
I want to make it possible create url that look like

http://..../eng/parts/index/named:param/named:param/

my route:
Router::connect('/:language/parts/index/*', array('controller' =>
'parts', 'action' => 'index'), array('language' => '[a-z]{2}'));

Paginator helper options:
[1] $paginator->options(array('url' => array(
'controller' => 'parts',
'action' => 'index',
'language' => 'eng'
)));

and paginator url is generated http://..../eng/parts/index/page:2
thats ok it is what i expected

but if i add any parameters
[2] $paginator->options(array('url' => array(
'controller' => 'parts',
'action' => 'index',
'language' => 'eng',
'another' => 'value'
)));

i am getting http://..../parts/index/page:2/language:eng/another:value
that is wrong

As i read in manual to use custom named parameters i must add with
Router::connectNamed(array('another'));
but is not working i am getting same url, also if i try add any
parameters with
Router::connectNamed now not working without "another" value [1]
getting http://..../parts/index/page:2/language:eng

All other url's is generating correctly, except pagination.

Can anyone please explain what i am doing wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: