Results 1 to 1 of 1

Thread: Regex Route with Zend Pagination

  1. #1
    maniac is offline Junior Member
    Join Date
    Mar 2010
    Posts
    1

    Default Regex Route with Zend Pagination

    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.
    Last edited by maniac; 03-03-2010 at 09:10 AM.

Similar Threads

  1. Regex route with XML config
    By supertino7 in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 05-31-2010, 01:04 PM
  2. Zend Route Regex ideas
    By nqnam in forum Model-View-Controller (MVC)
    Replies: 1
    Last Post: 04-21-2010, 12:03 PM
  3. Router REgex with pagination
    By __fabrice in forum Model-View-Controller (MVC)
    Replies: 10
    Last Post: 12-07-2009, 03:31 PM
  4. zend route assembling parameters from other route
    By erwanpia in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 11-02-2009, 11:56 AM
  5. Zend Route Regex - How to…
    By alokin in forum Model-View-Controller (MVC)
    Replies: 0
    Last Post: 10-31-2009, 08:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •