Tutorial :including language in paginator links


I have a multilingual site and I am trying to use the paginator. However the pages navigation never includes the language (just the controller and action are included)

<?php   echo $paginator->first(' << ', null, null, null);   echo $paginator->prev(' < ', null, null, null);   echo $paginator->numbers();   echo $paginator->next(' >', null, null, null);   echo $paginator->last(' >> ', null, null, null);  ?>   

Example: URL - http://dev.cyclistsroadmap.com/eng/segments/

Current: http://dev.cyclistsroadmap.com/main/segments/page:5

should be http://dev.cyclistsroadmap.com/eng/main/segments/page:5


Check this out. You can set extra parameters with paginate->options.

<?php  $paginator->options(array('url'=>array('lang'=>'eng')));  ?>   

Then add in your routes.php file like this. Then if you add the parameter in the options (as in the live above) then it should work as you want.

Router::connect('/:lang/:controller/:action/*', array(), array('lang' => 'eng/', 'property' => '[0-9]+'));  


The only way I got this to work was to hack the paginator library to add the lanuage. (unfortunate that cakephp made this so inflexible)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »