Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Simple Cakephp Pagination

    • 0
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 835
    Comment on it

    Cakephp provides a quick an easy way to paginate data.

    In the controller we start by creating the pagination condition as given below :

      public $paginate = array(
                'limit' => 10,
                'order' => array(
                'Model.fieldname' => 'asc'
            )
        );    
    
       public function listdetails(){
           $variable = $this->paginate("Model", array('Model.fieldname' =>'1'));
      }
    

    Write the following code in the view where pagination has to be displayed here the view name is listdetails.ctp

    <?php
        echo $this->paginator->prev('<<Previous', null, null, null); 
        echo $this->paginator->numbers();echo "&nbsp;|";
        echo $this->paginator->next('Next>>', null, null, null);
    ?>
    

 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: