[eluser]mr_menace[/eluser]
@Flak, I hope the following will help. I was able to set up template in the views/ folder and all the modules may work with it.
template->write_view() works fine too, and is able to find the correct view in
<APPPATH>modules/mymodule/views.If I understood correctly, your layout would work with the solution below.
After I made the changes suggested by Collin above, I was getting an error saying
"Unable to load the requested file: <APPPATH>/modules/mymodule/views/template.php". It was searching in the module directory only, but template.php file was sitting in the
<APPPATH>/views folder, since I want to reference a single master template it from any module.
After pouring through the Template/HMVC code, I realized that these two are using different Loader classes, and here's how I got them working in harmony.
First, I added the following method to Template.php
Code:
/**
* Override default CI loader object with another
* @return none
* @param object CI object to be set as loader
*/
function setLoader(&$l){
$this->CI->load = &$l;
}
After that, I just added the following lines the constructor of my controller class
Code:
$this->load->library('template');
$this->template->setLoader($this->load); //add this line. overrides Template 'load' object
If you are autoloading the template library, then the 1st line does not have to be inside the constructor, otherwise you have to make sure the 2 lines appear in the order shown above.
I am not sure of the repercussions of replacing the Template 'load' object with the HMVC one, perhaps someone more familiar with Template can enlighten me if this is safe to do. I have not tested this for long, but it has been working fine (so far).