oxo
(Uygarbayer)
July 24, 2012, 9:32am
1
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?
rookie84
(Lifeline Is)
July 24, 2012, 9:55am
2
I never have seen something like <SearchForm[query]> in a URL rule, what are you trying to acheive?
oxo
(Uygarbayer)
July 24, 2012, 10:00am
3
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
tehmaestro
(Alexnegrila89)
August 28, 2013, 8:57am
4
oxo:
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'); ?>