Reputation: 219
I am using HMVC and Template library (by Phil Sturgeon). The problem occur when I use Modules::run
in my code:
$this->template->title("Some title")->set_partial('header', 'showmessage')->build('showanothermessage', $data);
and in showmessage.php partial view:
echo Modules::run("goodbye");
The error page appear with:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: GoodBye::$agent
Filename: libraries/template.php
Line Number: 122
Fatal error: Call to a member function is_mobile() on a non-object in D:\Binh\wamp\www\codeigniter\application\libraries\template.php on line 122
How to fix this problem. Thanks in advance.
Update
My goodbye
controller:
class GoodBye extends MY_Controller{
function __construct(){
parent::__construct();
}
function Index(){ echo "Goodbye"; }
}
My MY_Controller
:
class MY_Controller extends CI_Controller{
function __construct(){
parent::__construct();
// default layout
$this->template->set_layout("home_layout");
}
}
My autoload
file:
$autoload['packages'] = array();
$autoload['libraries'] = array('database','session','template');
$autoload['helper'] = array();
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array();
Upvotes: 1
Views: 4303
Reputation: 219
I have changed my MY_Controller to:
class MY_Controller extends MX_Controller{
function __construct(){
parent::__construct();
// default layout
$this->template->set_layout("home_layout");
}
}
It worked!
Upvotes: 0