Cakephp provides a quick an easy way to paginate data.
In the controller we start by creating the pagination condition as given below :
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 " |";
- echo $this->paginator->next('Next>>', null, null, null);
- ?>
For such more Blogs you can visit to http://findnerd.com/NerdDigest
No comments:
Post a Comment