Pagination in CakePHP

In the controller file like I have Employeecontroller.php, write the following code:

<?php
class EmployeeController extends AppController
{
public $paginate = array(
‘limit’ => 2,
‘order’ => array(
‘Employee.id’ => ‘asc’
)
);

public function index()
{
$data = $this->paginate(‘Employee’);
$this->set(’employeeList’, $data);
}
}
?>

Now in the view file like I have index.ctp, write the following code:

<div align=”center”>
<!– Shows the page numbers –>
<?php echo $this->Paginator->numbers(); ?>
<!– Shows the next and previous links –>
<?php echo $this->Paginator->prev(‘« Previous ‘, null, null, array(‘class’ => ‘disabled’)); ?>
<?php echo $this->Paginator->next(‘ Next »’, null, null, array(‘class’ => ‘disabled’)); ?>
<!– prints X of Y, where X is current page and Y is number of pages –>
<?php echo $this->Paginator->counter(); ?>
</div>