passing variable value from library to controller and then to view in CI 3.0
Solved my problem, just forgot to include Admin_controller
file in Myoperator
controller file.
here is my updated code :
<?phpdefined('BASEPATH') OR exit('No direct script access allowed');require APPPATH. 'core/Admin_controller.php'; //forgot this line of codeclass Myoperator extends Admin_controller{ public function __construct() { parent::__construct(); //$this->load->model('myoperator_model'); } public function index() { try { $this->load->library('my_operator'); $data = $this->my_operator->run(); } catch (Exception $e) { var_dump($e->getMessage()); } $this->load->view('admin/myoperator/view', $data); }}
You can not extend core
class of CI from library.But
You can create entirely new libraries.
You can extend native libraries.
You can replace native libraries.
for more see Codeigniter Library
to use core CI files
in library.Create CI global instance using
$CI =& get_instance();
Then load required core files using $CI
.