MyController:
class MY_Controller extends CI_Controller {
public $data = array();
function __construct() {
parent::__construct();
$this->data['errors'] = array();
$this->data['site_name'] = config_item('site_name');
}
}
AdminController:
class Admin_Controller extends MY_Controller {
function __construct() {
parent::__construct ();
$this->data ['meta_title'] = 'Admin Panel';
$this->load->helper ( 'form' );
$this->load->library ( 'form_validation' );
}
}
UserController:
class User extends Admin_Controller {
public function __construct() {
parent::__construct();
}
public function login() {
$this->data['subview'] = 'admin/user/login';
$this->load->view('admin/_layout_modal', $this->data);
}
}
View: _layout_modal.php
$this->load->view($subview);
echo $meta_title;
But both $subview and $meta_title are throwing "Undefined variable" error.
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: subview
Filename: admin/_layout_modal.php