Can anyone point me in the right direction in order to write a URL rule in order to achieve the following: Using the base controller I want to get to each of the parameters in this url: DomainName/clientID/fileID
2 Answers
Haven't tested it, but this should work:
'rules' => array(
'<clientID:\d+>/<fileID:\d+>' => 'myBaseController/myAction',
)
Just make sure the one rule gets added before your Yii default URL rules. FYI, the rule assumes that both client ID and file ID are integers. If fileID contains letters, change it to fileID:\w+.
Comments
$url = $this->createUrl('timeSheetDetaile/create',array('timesheetID'=>$timeSheedID,'dayID'=>1));
first param is the name of your controller and second array is $_GET params .. have fun.
4 Comments
adm351
But isn't that to create a URL to go to that action? I'm trying to figure out how to set the urlManager rules in the main config to allow for two nested parameters that direct to the defaultController without mentioning the controller name in the URL. Because people will be given these URL's from outside the system.
kiamoz
dont worry about URL will be build
kiamoz
the domain name wont be in URL .. you wnat your domain name before controller ??
adm351
Yeah, I'm aiming for domain/parameter/parameter[then standard post vars]. Without the controller name or action being in the URL