nsanden
(Natesanden)
1
I’m using nested controllers like:
/protected/controllers/tools/calculators/IndexController.php
/protected/controllers/tools/calculators/IraController.php
/protected/controllers/tools/calculators/SavingaccountController.php
I can then access them by:
?r=tools/calculators/index
?r=tools/calculators/ira
?r=tools/calculators/savingaccount
etc.
How do I tell Yii, that if I ommit the final controller, that by default I want ‘index’? In other words, I want to do
?r=tools/calculators/
I am using in my config:
'defaultController' => 'index',
It works for top level controllers but not nested ones.
nsanden
(Natesanden)
2
I think i got it!
'<controller1:\w+>/<controller2:\w+>/<controller3:\w+>/' => array('<controller1>/<controller2>/<controller3>/index', 'caseSensitive'=>false),
'<controller1:\w+>/<controller2:\w+>/<action:\w+>.php' => array('<controller1>/<controller2>/index/<action>', 'caseSensitive'=>false),
'<controller1:\w+>/<controller2:\w+>/' => array('<controller1>/<controller2>/index', 'caseSensitive'=>false),
'<controller:\w+>/<action:\w+>.php' => array('<controller>/index/<action>', 'caseSensitive'=>false),
'<controller:\w+>' => array('<controller>/index', 'caseSensitive'=>false),
'<action:\w+>.php' => array('index/<action>', 'caseSensitive'=>false),
Yii doesn’t support nested controllers.
You should, instead, use modules.
nsanden
(Natesanden)
4
What do you mean? I have them nested and working fine.