How to put an exact number of pagination results cakephp 2x

0

I believe that for this code I can set an exact number of results per page on my page public $paginate = array('limit' => 7,); Except that the results do not follow this number and they end up coming random. Should I tinker somewhere else?

    
asked by anonymous 23.11.2015 / 16:30

1 answer

1

I think that's how you're doing.

Examples:

CakePHP 3:

class ArticlesController extends AppController
{

    public $paginate = [
        'limit' => 25,
        'order' => [
            'Articles.title' => 'asc'
        ]
    ];

    public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Paginator');
    }
}

CakePHP 2:

class PostsController extends AppController {

    public $components = array('Paginator');

    public $paginate = array(
        'limit' => 25,
        'order' => array(
            'Post.title' => 'asc'
        )
    );
}

But look for the CakePHP documentation. They always explain very well how its components work:

Documentation:

link link

    
23.11.2015 / 16:41