UrlManager question

Hi Guys, I need your help ;(

I want to script a little shop and I want to use urls like this: http://localhost/shop/Woman/Dessous and optional parameters like: pc = Which page is active, ac = How much articels are on one page

So, I configured my route rule like this:

‘urlManager’=>array(

		'showScriptName' => false,


		'urlFormat' => 'path',


		'rules'=>array(


			'shop/show/<first_name:\d+>/<second_name:\d+>/*' => 'shop/show',


		),

First and little problem is, my URL look like this:

http://localhost/shop/show/Woman/Dessous

and not like

http://localhost/shop/Woman/Dessous

if I remove the /show from the rule than I get an exception that the action Woman can not be found.

OK, but like I said this is the small problem!

The bigger problem is, my GET Array look like this:

array(1) {

["Woman"]=>

string(7) "Dessous"

}

…how should I work with this???

In my Controller I need an array with the named index "first_name", "last_name" and so on.

The perfect example is the .NET MVC Framework, in this you can declare your Action like (Converted into PHP)

public function actionShow($first_name, $second_name)

And the framework looks if it found parameters in the request with the name in the action decleration!

But, anyway, I need only a way to access my Route Values, can someone help me?

Best regards

Your pattern is incorrect. Instead of <first_name:\d+>, you should write <first_name:\w+>。

OK, thx, I changed it, but nothing happend!

Did you also change second_name?

Yes, for sure!

I guess you have another rule before this one which matches the request.

This is my complete urlmanager section:

‘urlManager’=>array(

		'showScriptName' =&gt; false,


		'urlFormat' =&gt; 'path',


		'rules'=&gt;array(


			'shop/show/&lt;first_name:&#092;w+&gt;/&lt;second_name:&#092;w+&gt;/*' =&gt; 'shop/show',


		),


	),

Your setting looks fine to me. Given a URL “path/to/shop/show/abc/def”, you should expect to access the route ‘shop/show’ with GET parameter first_name=abc and last_name=def. What do you see now?

What about this?


'urlManager'=>array(

			'showScriptName' => false,

			'urlFormat' => 'path',

			'rules'=>array(

				'shop/<first_name:\w+>/<second_name:\w+>/*' => 'shop/show',

			),

		),

you want shop/firstname/lastname