Hey, guys!
Could somebody advice on how to correctly set the controllerMap property?
I’ve created a fresh webapp and created a module called core.
My controllerMap property is like:
'controllerMap'=>array(
'mysite'=>array(
'class'=>'application.modules.core.controllers.DefaultController',
),
)
But when i try to access the url localhost/app?r=mysite i get the error
DefaultController cannot find the requested view "index".
Could try setting "viewPath" but it is readonly
Any suggestions, please?
Thanks in advance!
mentel
(Yii)
April 18, 2011, 7:07pm
2
You should use CWebApplication::defaultController, like this:
'defaultController'=>'mymodule/mycontroller',
thanks, but its not exactly what I want to do…in fact, I have a module called core and don’t want the string “core” to appear in the url…this is why i’m trying to use controllerMap
any ideas?
tks
mentel
(Yii)
April 19, 2011, 3:28am
4
You have to create a custom URL rule and omit that word on the rule.
Let me know if you need more details.
Could you please provide me a sample showing the rule?
Thanks in advance.
ps. still confused when should i use controllerMap
mentel
(Yii)
April 19, 2011, 11:37am
6
It should be something like
'myurl'=>'core/default',
mentel
(Yii)
April 19, 2011, 11:39am
7
controllerMap is used to configure controllers. It doesn’t apply to URLs.
Thanks, will do. I’m afraid of decreasing performance because my entire system is modular, so i’d have too many rules to cover all urls.
Still wondering when to use ControllerMap and what’s the difference in terms of performance to url rules.
Any idea?
tks
mentel
(Yii)
April 19, 2011, 11:51am
9
To have better performance, enable caching.
ControllerMap has nothing to do with URL rules, AFAIK.