I have change my frontend-app config like this : (I use advanced template)
...
'controllerNamespace' => 'mymodule\controllers',
'defaultRoute'=>'default',
...
so my application in first always read default controller in module was I specified in config as home.
But the problem in view, view path always to frontend\views, not to mymodule\views. can help me??..
Did not get you - if you are using a module controller, the view path will be module\views for any actions in the module.
Are you talking about other actions outside the module trying to use a view within the module?
Did not get you - if you are using a module controller, the view path will be module\views for any actions in the module.
Are you talking about other actions outside the module trying to use a view within the module?
I want the home of my application is a module. so, every my application start, always call controller in module was I defined in config like above. the controller success called, but why the view path call to frontend\views??
If you are calling a controller action within a module, it should use viewPath within the module by default.
So something like:
http://localhost/module/controller/action
should automatically use a view path within the module/views.
Where are you getting frontend/views as the viewPath within your module?
amnah
(Jellysandwich5+1)
May 24, 2014, 1:28pm
5
He’s not calling a controller within a module - he simply changed the controller namespace in the main Yii app (yes, the main yii app is actually considered a “module”).
I don’t think this is the proper way to do things, but here’s the solution:
...
'controllerNamespace' => 'mymodule\controllers',
'defaultRoute'=>'default',
'viewPath'=>'mymodule\views',
...
Ah… I missed understanding this… if this is the case… thks.
amnah:
He’s not calling a controller within a module - he simply changed the controller namespace in the main Yii app (yes, the main yii app is actually considered a “module”).
I don’t think this is the proper way to do things, but here’s the solution:
...
'controllerNamespace' => 'mymodule\controllers',
'defaultRoute'=>'default',
'viewPath'=>'mymodule\views',
...
thank you amnah, this correct path
...
'viewPath'=>'@mymodule/views',
...