[eluser]riwakawd[/eluser]
I am trying to set up a custom MY_Loader.php file which will let me add this link in the public index $data['header'] = $this->load->controllers('common/header'); and any other I might like to add. The word "common" is the subdirectory.
I am trying to get it so can type it like so. I know it can be done but just do not know how.
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Loader extends CI_Loader {
public function controllers($subfolder, $filename) {
$CI =& get_instance();
APPPATH . 'controllers/'. $subfolder . $filename '.php';
}
}
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MY_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
$data['header'] = $this->load->controllers('common/header'); //common is subfolder
$data['footer'] = $this->load->controllers('common/footer'); //common is subfolder
if (file_exists(APPPATH. 'views/theme/' . $this->config->item('config_template') . '/templates/common/home.tpl')) {
$template = $this->config->item('config_template') . '/templates/common/home.tpl';
} else {
$template = 'default/templates/common/home.tpl'; // Fall Back
}
$data = array('theme' => $this->config->item('config_template'));
return $this->smarty->view($template, $data);
}
}