Got a report from Russian community member:
ME — 5.2.0.9
CI — 1.7.1
In the main application I use my own library for templates output.
application/libraries/Viewlib.php
class Viewlib
{
public $CI;
public function __construct($params = array())
{
$this->CI = &get;_instance();
}
public function show($template, $data = null, $return = false)
{
return $this->CI->load->view($template, $data, $return);
}
}
In the master template I’m calling several modules and templates.
— master template (app views folder) calling module (module uses it’s own views folder)
— master template (app views folder) calling another template (“footer” from main app views folder)
— getting an error “File not found”.
Doing a bit of debugging showed that template path points to last used module views folder.
application/controllers/welcome.php
class Welcome extends Controller
{
public function __construct()
{
parent::Controller();
$this->load->library('viewlib');
}
public function index()
{
$this->viewlib->show('main_app_template');
}
}
modules/module/controllers/module.php
class Module extends Controller
{
public function __construct()
{
parent::Controller();
}
public function index()
{
$this->load->view('module_template');//use CI Output.
}
}
application/views/main_app_template.php
<div> <?php Modules::run('module'); ?> </div>
<?php
echo $this->viewlib->show('main_app_template_footer'); // here I've got "file not found"
?>