Question regarding URL with several parameters

Hello

I have one question, maybe you can help me out.

I want the following Url


http://mysite/mycontroller/id/gid

To be taken care of by mycontroller/view

So I have the following in urlManager and I was hoping that the first rule would take care of it:




	'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>false,

			'rules'=>array(

				'mycontroller/<id:\w+>/<gid:\w+>'=>'mycontroller/view',

				'mycontroller/<id:\w+>'=>'mycontroller/index',

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

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

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

			),



But I keep getting: The system is unable to find the requested action "whatever-it-the-id-is"

What I am doing wrong ?

Regards,

Nuno

Very interesting!

I just try your example and found one really weird solution.

There’s only one allowed separator character that you can use for $_GET params:


_(underscore)

Believe me or not this will work:




<?php echo CHtml::link('test', array('site/contact', 'id' => 'some_id_param', 'gid' => 'some_gid_param')); ?>






// urlManager rules

...

'site/<id:\w+>/<gid:\w+>' => 'site/contact',

...



But this won’t:




<?php echo CHtml::link('test', array('site/contact', 'id' => 'some-id-param', 'gid' => 'some-gid-param')); ?>



Try it!

That worked, I feel so dumb, I didn’t remember that \w didn’t support - and this what was causing problems.

Thanks a lot :D

Case closed …