matching array params in url rules


I have the following rule defined in my url rules






		'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

and this is what I currently have[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

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

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


you can use CController

for e.g

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