Need help with CLinkPager and urlmanager

I have problems getting the CLinkPager with the rules of my urlmanager to work.

In urlmanager I have the following rules:


'guestbook/<Guestbook_page:\d+>' => 'pages/show/id/9',

'guestbook' => 'pages/show/id/9',

This is simply to beautify the urls. The show action simply calls the guestbook module which fetches the data. Then the render method is called in the show action.

The Linkpager in view:


<?php $this->widget('CLinkPager', array(

	'pages' => $data->pagination,

)); ?>

The generated urls look like this: h*ttp://localhost/pages/show/9?Guestbook_page=2

but I want them to look like: h*ttp://localhost/guestbook/2

according to the rule set in urlmanager.

However if I do


<?php echo $this->createUrl('/pages/show/id/9', array('Guestbook_page' => 2)); ?>

it gets me my nice looking url.

Am I missing something here or is this a bug in CLinkPager?

Thanks in advance.

This question is kinda old, but I’m looking for the answer on the exact same thing. Could anyone tell me if this is possible? And since this topic got 1100+ views, I think it deserves an answer :lol:

edit: Well, for me it works by changing the rules of the urlManager.

For example:




		'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>false,

			'caseSensitive' => false,	

			'urlSuffix' => '.html',	

			'rules'=>array(					

	'<controller:\w+>/<action:\w+>/category/<category_id:\d+>/<name:[a-zA-Z0-9-]+>/page/<page:\d+>'=>'<controller>/<action>',



CLinkPager adapts to it and create URL’s like:

acticles/index/category/234/interesting/page/2.html

:D

Hope somebody can use this.

/* Moved to General Discussion */