Vince
(Vadimg88)
January 1, 2009, 1:01pm
1
I have the following controller structure:
Unless i go in the config/main.php file to add those :
'orders'=> array(
'class'=>'application.controllers.orders.OrdersController'
),
'index'=> array(
'class'=>'application.controllers.index.IndexController'
),
to the 'controllerMap' array i cannot access the controllers by accessing index.php?r=index or index.php?r=orders
Is there anyway to override the need to add the controller to the 'controllerMap' array every time a new controller is added?
Thanks.
qiang
(Qiang Xue)
January 1, 2009, 1:11pm
2
Because your controls are in subdirectories of 'controllers', you can refer to them using: path.to.ControllerName
For example, index.index or orders.orders
Vince
(Vadimg88)
January 1, 2009, 1:39pm
3
Sorry didn't quite get it, Could you elaborate?
Thanks,
qiang
(Qiang Xue)
January 1, 2009, 2:10pm
4
Let's say you have a controller located as:
protected
controllers
admin
user
ProfileController.php
The ID for this controller would be 'admin.user.profile', and the route for an action 'edit' of this controller would be 'admin.user.profile/edit'. You don't need declare the controller in the controllerMap if you refer to your controller using this ID format.
Vince
(Vadimg88)
January 1, 2009, 2:22pm
5
Ahh got it, Very clever. Thanks.