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

Reply via email to