Perfect!

Thanks

Dave 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of John Andersen
Sent: February-23-10 7:29 AM
To: CakePHP
Subject: Re: Product Pagination Question

In the CakePHP book at http://book.cakephp.org/view/166/Pagination-in-Views,
nearly at the bottom, is specified how to pass the original parameters in
the Paginator.
Enjoy,
   John

On Feb 23, 11:53 am, "Dave" <[email protected]> wrote:
> I have this index function
>
> function index( $category_id = null ) {
>
>   if (!$category_id) {
>    $this->Product->recursive = 0;
>    //$this->set('products', $this->paginate());
>    $this->paginate = array(
>
>            'limit' => 2);
>
>    $products = $this->paginate('Product');
>
>        $this->set(compact('products'));
>   }
>
>   if ( !empty( $category_id ) ){
>
>    $this->paginate = array(
>            'conditions' => array(
>      'Product.category_id ' => $category_id),
>            'limit' => 2);
>
>    $products = $this->paginate('Product');
>
>        $this->set(compact('products'));
>
> }
>
>  }
>
> So I pass the category_id to paginate the category of items.
> First page works fine /products/2 paginates the first page of the "2"
> catergory_id  of products.
>
> Click next and I get products/index/page:2 the "2 category_id" get 
> dropped so its back to paginating all products. How can I keep the 
> pagination going here?
>
> Thanks
>
> Dave

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 
cake-php+at http://groups.google.com/group/cake-php?hl=en

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