controllerMap gives me exception when using module

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!

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

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

It should be something like


'myurl'=>'core/default',

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

To have better performance, enable caching.

ControllerMap has nothing to do with URL rules, AFAIK.