I'm having a difficult time passing inherited data from an extended controller to my view in codeigniter application.
I have my backend_controller and my control panel code as the following. I also include what I do in the view below.
When I load the load the page I receive the undefined variable cms name error. I was under the impression I correctly passed the data correctly.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Backend_Controller extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->my_backend();
}
public function my_backend()
{
$data['cms_name'] = $this->config->item('cms_name');
}
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Control_panel extends Backend_Controller
{
/**
* Loads models, configs, helpers.
*/
public function __construct()
{
parent::__construct();
}
/**
* Loads the control panel.
*/
public function index()
{
$this->template
->title('Dashboard')
->build('dashboard_view', $this->data);
}
}
<?php echo $cms_name; ?>