Welcome Guest, Not a member yet? Register   Sign In
[Solved] Need Help MY_Loader Custom Setup Query
#1

[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);
}
}


Messages In This Thread
[Solved] Need Help MY_Loader Custom Setup Query - by El Forum - 04-12-2014, 07:44 AM
[Solved] Need Help MY_Loader Custom Setup Query - by El Forum - 04-12-2014, 03:20 PM
[Solved] Need Help MY_Loader Custom Setup Query - by El Forum - 04-12-2014, 08:12 PM
[Solved] Need Help MY_Loader Custom Setup Query - by El Forum - 04-13-2014, 02:58 AM
[Solved] Need Help MY_Loader Custom Setup Query - by El Forum - 04-13-2014, 06:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB