Reputation: 3804
What I want is to have the menu, footer and header from the main site, while the content belong to the template of a module. So which can be done and how?
or
I get that a module is a self-contained application, but is there anyway to connect it to the main application? The method render doesn't seems to provide this mechanism.
I need an answer example.
EDIT
Ok, after searching a bit. I found that you can do like this from the view of a module:
$this->render("//view_folder/a_view")
With double slash "//", it will call for the view of the main application under view_folder/a_view.php While with a single slash
$this->render("/view_folder/a_view")
It will call for the view inside this same module.
Still searching if there is any way for a main view to call for a module view or views betweens modules.
Upvotes: 1
Views: 327
Reputation: 3804
To call a module view from application view or controller
$this->render("application.modules.moduleName.views.folderName.fileName");
Upvotes: 1
Reputation: 5955
Main views aren't likely to be able to call module views, due to way rendering works (Yii starts with your render partials and works on up to the layout file.
If you need to get more creative with rendering though, look into the theme system. It gets a bit squirrelly (the easiest way to understand what is going on is to use a debugger like XDebug), but you have a lot of options.
Upvotes: 0