I am trying to transfer some data from my user library to the controller and make it available in my opinion. For life, I do not see where I am wrong.
I am going to get database results; for testing, I resorted to a simple array, but it still does not work.
Library:
class Test{
public function __construct(){
$this->CI =& get_instance();
}
public function getStuff(){
$test = array('one','two','three');
return $test;
}
}
Controller:
function __construct(){
parent::__construct();
$this->load->library(array('form_validation', 'test'));
}
public function index(){
$data['q'] = $this->test->getStuff();
$this->load->view('index', $data);
}
View:
var_dump($q);
Late, so it could be a dumb mistake / typo. It uses CodeIgniter 2.1.0. For me Googled it is - none of the solutions seem to work.
Thanks for watching!
source
share