Hi, I am trying to get a regex route working with the Zend_Paginator, but the links to other pages are not coming out correctly.
Here are some examples urls:
url:
/categories/sport
params:
category = sport
page = 1
url:
/categories/sport/page2
params:
category = sport
page = 2
url:
/categories/home_and_garden/diy/page2
params:
category = home_and_garden/diy
page = 2
As you can see, the complication is that the category could be a list of any number of nested categories and I don't know how many of them there will be. This is why I think I need a regex route.
I've got the route working:
Code:
$router->addRoute('category',
new Zend_Controller_Router_Route_Regex(
"categories/(.+?)(/page([0-9]*))?",
array('module'=>'mymodule', 'controller'=>'categories', 'action'=>'index', 'page'=>'1'),
array(1 => 'category', 3 => 'page'),
'categories/%s'
)
);
However, it doesn't work with Zend_Paginator. All of the links in my pagination controller come out without pages.
e.g. at
/categories/home_and_garden/diy
or
/categories/home_and_garden/diy/page2
all links go to:
/categories/home_and_garden/diy
I'm guessing it may be something to do with reverse regex routes, but I don't really understand what the %s bit is.
I'd be very grateful for any advice.
I'm happy to revise my url a little (e.g. ../page/2 instead of ../page2) if it helps, but I think I need to retain the list of slash separated categories for SEO.
Thanks.