Snippet : How to Build Better URL CakePHP Pagination Just Like on WordPress

pagination on cakephp

Here is best cakephp snippet to build and rewrite pagination URL. You can build url like this (such as wordpress pagination)

Here is the superb snippet for it

Add this on AppController.php

function beforeFilter(){
		if (isset($this->request->params['page'])) {
			$this->request->params['named']['page'] = $this->request->params['page'];

Add this code to route.php

    array('controller' => 'controller', 'action' => 'index'),
        'pass' => 'page',
        'page' => '[0-9]+'

Pagenave.js : Simple Jquery Plugin to Create Pagination System

When you have enough data then the most important thing when will display it is with the pagination so that users can see the data easily and quickly. Let’s say you have 1000 data, then the pagination is a good idea.

Pagenav.js can be used in building numbered pagination systems, a well-known and well-used navigation system for large data collections embedded on a Web page.

The plugin comes with support for next/prev controls and a current page indicator.