umutau
(Umutau)
May 10, 2011, 6:51am
1
Hi,
I would like to add rule into url manager. It works fine but I can’t get the $1 and $2 values. Any idea ?
<?php
class UrlManager extends CUrlManager {
protected function processRules(){
$this->rules['home']='resellersite/index';
$this->rules['signup']='resellersite/signup';
$this->rules["^(login)/([a-zA-Z0-9\-_.|]+)/([a-zA-Z0-9\-_.|]+)"]="resellersite/customerLogin/$1/$2";
parent::processRules();
}
}
?>
Asgaroth
(Asgaroth Belem)
May 10, 2011, 1:16pm
2
Why are you adding rules there and not in the Application configuration? :S
kbradwick
(Kbradwick)
May 10, 2011, 11:06pm
3
There is no need to extend CUrlManager to define your own rules, you define them in protected/config/main.php see here http://www.yiiframework.com/doc/guide/1.1/en/topics.url#user-friendly-urls
umutau
(Umutau)
May 10, 2011, 11:27pm
4
I have more staff to go into rule from database. I just clean up before i add into forum. I have content management and use clear url for reseller to enter their url info and i add them to rule. So I have to use another class.
umutau
(Umutau)
May 10, 2011, 11:36pm
5
Actually what i want is once the customer come with
mywebsite.com/login/requesteditem/computer
i want to direct page to
resellersite/customerLogin page with parameter requesteditem=>computer
any idea how can I do as a rule this one ?
umutau
(Umutau)
May 10, 2011, 11:54pm
6
thanks all problem solved
i just add
$this->rules['login/*']='resellersite/customerLogin';