Hello everyone,

My first post to this list. I've been digging the conversation here. Glad to know there's a healthy support community around Cake.

I have a situation where I have a somewhat elaborate routing scheme for fetching a list of products. I'd like to be able to paginate this list and have indeed got everything working that I need on the actual pagination processing. What's missing is the ability to pass the page number to my Products controller. None of my intuitive attempts at making this work have succeeded. I'm on Cake 1.2.

Example: Let's say I want a list of all products of size Junior and category Apparel. The URL would look something like:

http://mysite.com/ps-junior/c-apparel

My route will then hand off the appropriate args to my controller. However, if I add a page number, viz:

http://mysite.com/ps-junior/c-apparel/page:2

I still get only the first page. So...is there a way to set the page number, say, from within the controller? I can't access the $paginator object (I think), so maybe I can set a value within the $paginate property of the controller?

Here's my route declaration for reference:

// routes for product listing views -- flexible enough to handle leaving out any args
Router::connect(
'/:type/:category/:product_size_category/:product_size/:color/:gender/ :vendor/:date/:page',
                array(
'controller' => 'products', 'action' => 'index', 'type' => null, 'category' => null, 'product_size_category' => null, 'product_size' => null, 'color' => null,
                        'gender' => null, 'vendor' => null, 'date' => null, 'page' 
=> null
                ),
                array(
'pass' => array('type', 'category', 'product_size_category', 'product_size',
                                                        'color', 'gender', 
'vendor', 'date', 'page'),
                        'type' => 'designers|whats-new|sale',
                        'category' => 'c-[a-zA-Z0-9&%\{\}_-]+',
                        'product_size_category' => 'psc-[a-zA-Z0-9\{\}_-]+',
                        'product_size' => 'ps-[a-zA-Z0-9\{\}_-]+',
                        'color' => 'cl-[a-zA-Z0-9\{\}_-]+',
                        'gender' => 'for-[a-zA-Z0-9_-]+',
                        'vendor' => 'v-[a-zA-Z0-9\{\}_-]+',
                        'date' => '\d\d\d\d-\d\d-\d\d',
                        'page' => 'page:\d+'
                )
        );

Can anyone shed some light?

Many thanks,
-Brian

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to