Daniel,

You're trying to do a find (for your Category data) and thinking you can 
then paginate the contained Posts it fetches, you cannot.

I advise you spend some time going through the book's pages on pagination 
to understand it:
http://book.cakephp.org/view/1231/Pagination

In essence you need a separate find for your category:
$this->set('category', $this->Category->find('first', array( 
  'conditions' => array('Category.id' => $id), 
  'contain' => array( 
    'Post' => array('User' => array('id', 'username') ) 
  )
))); 

And a separate paginate for the post records you want to paginate:
$this->paginate = array( 
  'Post'    => array( 
    'limit'    => 2, 
    'page'    => 1, 
    'order'    => array('Post.created'    => 'desc'),
    'conditions' => array('Post.category_id' => $id)
  ) 
); 
$this->set('posts', $this->paginate('Post')); 

You probably have a HABTM relationship between Category and Post, so need 
to change the paginate conditions accordingly.

HTH, Paul.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to