The problems may be many-folded which all simplifies to one simple issue:
Say, you want to display url in the following format using custom routes
CakePHP default url structure
Your WELL FORMATTED URL structure:
Obviously, your custom route element points to 'index' action of 'categories' controller with two parameters - category-name and 'categoryID'.
array('controller' => 'categories', 'action' => 'index'),
// order matters
'pass' => array('slug','id'),
This works perfectly for URLs like
But it may cause problem when you try to paginate
Cake will not pick your params (here 'slug' and 'id') passed through url if you do not force Cake to do so while paginating.
To fix this issue, you MAY use:
$paginator->options(array('url' => $this->passedArgs));
or, as I have told here earlier following CakePHP book.
But this will format your paginated urls like
You can obviously browse pages with the above url. But it does not look decent. So, your entire effort with custom routing might just not work.
You may still get a bad URL.
DO NOT WORRY!
While defining paginator options in your view file, follow religiously $html->link() structure. For an example I have put forward the structure of $paginator->options() below in a view file:
'controller' => 'categories',
'action' => 'index',
Now Cake will make well formatted URL automatically, and your paginated url should look like
I hope it helps someone.
I have marked asterisk symbol (*) with RED color while talking about custom route elements. This (*) MUST be there for pagination to work properly.