CPagination generates wrong url

Hi there!

I recently added the following rule to the URL manager:


This means if I have an url like this:


then it will be parsed as the route: ‘user/reviews’ with GET parameter ‘id’ being ‘10’. That works.

Now I added a CGridView to my page and the navigation links are broken:

	'pagination' => array(

		'pageSize' => 10,

		'route' => 'user/'.$id.'/AjaxDetails',


The urls of the navigation buttons are: index.php/user/10/AjaxDetails/page/2 and it should be: index.php/user/10/AjaxDetails?page=2

I managed to debug all the way down and I found why the parameters added with ‘/’:

CUrlManager.php -> createUrlDefault($route,$params,$ampersand)





		return $route==='' ? $url : $url.$this->urlSuffix;



Here $this->appendParams is TRUE and it should be false. Docs:

I can’t figure out how to make this work. Any suggestion would be appreciated!


This one would be okay but not in the desired url format:

	'pagination' => array(

		'pagesize' => 10,

		'route' => 'user/AjaxDetails',

		'params' => array(

			'userId' => '10'



would generate:


The desired URL format is:


Anybody? Any help would be great!

I recently encountered a similar issue, and I ended up overriding my SiteController’s createUrl method. There I ‘manually’ created some urls. Ie.:

public function createUrl($route, $params=array(), $ampersand='&'){

    if (array_key_exists('page',$params) /* && some other condition*/) return /*a custom URL*/ ;

    //this was in the original method  



           else if(strpos($route,'/')===false)


           if($route[0]!=='/' && ($module=$this->getModule())!==null)


           return Yii::app()->createUrl(trim($route,'/'),$params,$ampersand);            


It’s not very pretty but it works.