This blog will let you know how to declare pagination limit in cakephp globally. For new beginners who are learning cakephp 2.X, I am writing this blog especially for them. If you have created multiple pages which contains pagination and at last you remember that you have forgotten to add page limit to each page, then you don't need to worry about it. Just declare pagination in beforeFilter() in AppController. How to do this? Lets have a look on the code below:
In AppController.php add following lines:
class AppController extends Controller {
public function beforeFilter() {
// Add pagination for all pages globally, set paginate limit here
$this->paginate = array('limit'=>10);
}
}
Thats all!. Now you can see in all the pages , pagination limit is set to 10.
Thanks for reading the blog.
0 Comment(s)