matching array params in url rules

Hi,

I have the following rule defined in my url rules


'urlManager'=>array(

	'urlFormat'=>'path',

	'showScriptName'=>false,

	'caseSensitive'=>false,

	'rules'=>array(		

		'category/list/<SearchForm[query]:\w+>' => 'category/view'				

	),

)

but when I create a url like this


Yii::app()->createUrl("category/list", array('SearchForm' => array('query' => 'media'));

I’m getting the following error;

urlencode() expects parameter 1 to be string, array given

After getting this error I tried this


Yii::app()->createUrl("category/list", 'SearchForm[query]' => 'media');

It fixed the error but I cannot still hide the SearchForm[query] parameter from the url.

In brief, this is the url that I’m trying to create http://www.mysite.com/category/list/query/media

and this is what I currently have http://www.mysite.com/category/list/SearchForm[query]=media

anyone have experience with a problem like this?

I never have seen something like <SearchForm[query]> in a URL rule, what are you trying to acheive?

Actually, I’ve simplified the url a little bit to make it more understandable. In my case a search form is submitted using GET method and the url looks something like this after the submission


http://www.mysite.com/category/list/SearchForm%5Bquery%5D=media&SearchForm%5Bcategory%5D=Computer&SearchForm%5Bcompany%5D=Apple

I just want to hide the array name from the url and have something like this;


http://www.mysite.com/category/list/query/media/category/Computer/company/Apple

Sorry for digging up this topic, but I’m looking for the exact same thing. Any way I can do this ?

Hi,

you can use CController

for e.g


<?php echo CController::CreateUrl('//gallery/mail?action=index'); ?>