i have a codeigniter application with 5 controllers one is the 'base' and the rest are inheriting form it, i am using global variable in the base to load in the view but it's not working i get (Undefined variable) when i load the view how can I fix this?
i'm using this function in the base to load the views
function _setContent($tplFile) {
ob_start();
$this->load->view($this->theme_dir . '/' . $tplFile, $this->tplData);
$_content = ob_get_contents();
ob_end_clean();
$this->tplData['_content'] = $_content;
$this->load->view($this->theme_dir . '/default', $this->tplData);
}
$this->tplData // is the global variable
trueas the third parameter to theview()function to return the content rather than echo-ing it (so you dont need to use ob_* functions)