Scooby
Scooby

Reputation: 272

Yii 1.1 CLinkPager generated uncomplete url

I'm new in Yii 1.1. and i have a problem in generating url using CLinkPager.
The right url is http://example.com/read/group/car?page=2 [baseurl/controller/action/id?page_number] but yii 1.1 CLinkPager generated wrong url (http://example.com/read/group?page=2) and missed */car.

my config/main.php is like

... 
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/*<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
...

How configure yii to get the right url?
Thanks in advance.

Upvotes: 0

Views: 254

Answers (1)

Dinistro
Dinistro

Reputation: 5730

You're having a problem with your rules, replace them with:

'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\w+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

You tried to use <id:\d+> but \d stands for digit. so you need to replace it with \w (word character)

Upvotes: 0

Related Questions