Pass more than one parameter on url

Hi folks,

I’m having some problems to pass more than one parameter on url.

I’m using tha url path and hen I pass only one parameter, everything works great like it:

$options = array('id' => 5);

CHtml::link($model->$field, Yii::app()->getController()->createUrl('update', $options);


# print_r($_GET) prints Array('id' => 5)

But, when I passed 2 (or more) parameters, this happend:

$options = array('type' => 'Product', id' => 5);

CHtml::link($model->$field, Yii::app()->getController()->createUrl('update', $options);

#output  - the expected result

# print_r($_GET) prints Array('Product' => 5)

ie I can’t get the id or Product params becouse the key of id change to value of type.

My urlManager configuration is:

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

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

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

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

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

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

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

Anyone have an Idea of why this are happening?


I’m not a regexp expert, but I think ‘Product’ doesn’t match \w because \w is (I think) for lower case words. So try ‘product’ instead.

Did you find the problem?

Hi dude, I found the solution but on a different way.

I investigated your sugestion about regex and saw that I have forgot to put one "+" by side of \w

So tha solution was write the regex like this \w+