"It looks like an array to me ('limit' => 21, 'page' => 1) for paging 21 users on one page. If I change the limit to 200, then it splits pages into 200 pages on only one page .. . in this case, how to limit along with the correct pagination? - Anonymous
yes, you can use the pagination cakePHP helper as someone mentioned. But there may be times when you want to make your own pagination or simply limit the number of records received per call. Why is it here, how did I deal with this situation.
Say, for example, you want to get a certain number of entries on a page, then: $ start = 0; β this is to start receiving recordings starting from the first. If you need to say, for example, start at the 31st, then $ start = 30;
So $ start = 0; $ length = 20; // we are going to extract 20 records, starting from the first record
And the code will look something like this:
// To retrieve a number of Products per page $products = $this->Product->find('all', array( 'order' => 'product_number ASC', 'limit' => $start.','.$length, 'recursive' => -1 ) );
Vicer
source share