Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to declare pagination limit in cakephp global ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 172
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: