Skip to main content

Posts

Showing posts with the label Cakephp pagination

CakePHP pagination

Paginate provide a set of controls to navigate through paged data. Pagination inside Controller class RecipesController extends AppController {     public $components = array('Paginator');     public $paginate = array(         'limit' => 25,         'contain' => array('Article')     ); } Pagination define inside function public function list_recipes() {     $this->Paginator->settings = $this->paginate;     // similar to findAll(), but fetches paged results     $data = $this->Paginator->paginate('Recipe');     $this->set('data', $data); } You can filter the records by passing conditions as second parameter to the paginate() function: $data = $this->Paginator->paginate(     'Recipe',     array('Recipe.title LIKE' => 'a%') ); Pagination with behaviour  $this->paginate=array('conditions'=...