CakePHP routing & pagination problem -


i have app i'm working on @ moment pretty strange routing involving passed args. works fine, links reverse routed correctly except pagination. i'm tearing hair out must missing something.

my routes are:

router::connect('/manufacturer/:manufacturer/:friendly0', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1/:friendly2', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1', 'friendly2'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1/:friendly2/:friendly3', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1', 'friendly2', 'friendly3'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1/:friendly2/:friendly3/:friendly4', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1', 'friendly2', 'friendly3', 'friendly4'))); 

and have added passed args paginator options this:

$this->paginator->options(array('url'=>array(     'controller' => 'categories',     'action' => 'view',     'manufacturer' => 'nsm',     'friendly0' => 'accessories' ))); 

however, paginator links come out this:

/categories/view/page:2/manufacturer:nsm/friendly0:accessories

they should be:

/manufacturer/nsm/accessories/page:2

can help?

thanks in advance.

edit:

if add /* end of each route pagination links , regular links work expected first route only. i'm guessing when other routes should matched during dispatch first route true due /*.

interestingly, if change order of these routes this:

router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1/*', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1'))); router::connect('/manufacturer/:manufacturer/:friendly0/*', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0'))); 

then cake seems think page:2 named param should passed arg , passes friendly:1.

answer question helped fix problem. shaz.

consolidate cakephp routes


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -