[eluser]Unknown[/eluser]
Hi,
I'm trying to fill a view with data from within a library. The code looks like this:
Code:
class ALibrary {
private $CI;
function __construct() {
$this->CI =& get_instance();
}
function show_view($viewname,$data) {
$view_content = $this->CI->load->view($viewname,$data,TRUE);
$this->CI->load->view('layout',array(
'content' => $view_content
));
}
}
The view $viewname is written correctly, but the $data is not written to the view, although it's available in the function (I can print_r it there).
Eg. $data looks like this:
Code:
$data = array(
'mydata' => 'Hello world'
);
Shouldn't I be able to use
Code:
<?php echo $mydata; ?>
to get 'Hello world'?
Thanks,
Oliver