Having just found this... you are right it is exactly what I need. Thanks for this pointer.
As for my code... I have spent the day tidying it up as each book has 2 many to many relationships ( Categories and Authors ) so it was getting in a mess. On Tue, 2011-01-25 at 14:35 -0500, cricket wrote: > On Tue, Jan 25, 2011 at 9:00 AM, Steve <[email protected]> wrote: > > I have solved this by overriding the paginate and paginateCount methods > > in my Book model. > > Instead of that, you could use Containable. > > And you don't need to have the else block in the index action. Declare > $paginate as a class var, then add the 'conditions' array when > required. > > public $paginate = array( > 'limit' => 12, > 'order' => array('Book.created' => 'desc'), > 'contain' => array('Author') > ); > > function index() > { > $this->Book->recursive = 1; > > if ($this->search) > { > $this->paginate['conditions'] = > $this->Book->searchConditions($this->search)); > } > > $this->set('books', $this->paginate('Book')); > } > -- 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
