• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ME HMVC + custom library + fetch_module() does not work right

#1
[eluser]wilso417[/eluser]
$CI->router->fetch_module() for HE HMVC does not behave correctly in the following situation.

A custom library I made:

class Test_Library {

function shout_module() {

$CI =& get_instance();
echo $CI->router->fetch_module()."<br />";
}
}

A module/controller I made:

class Test2 extends MX_Controller {

public function index() {

$this->load->library('test_library');
$this->test_library->shout_module();
}
}

A module/controller I run:

class Test1 extends MX_Controller {

public function index() {

$this->load->module('test2');
$this->test2->index();

$this->load->library('test_library');
$this->test_library->shout_module();

}
}

The output is:

test2
test2

The expected output is:

test2
test1

I am using fresh installs and the newest version of CI (2.0.2) & ME HMVC (5.4). I have tried to auto-load the library and remove the load->library calls and that did not work either. I even tried a solution similar to form_validation->CI = &$this. Where a $CI variable inside the library was set before shout_module() was called and that did not work either.

This was just a sample I made to demonstrate the issue. I really need a library to see what module called it for searching/templating purposes. I know I could have that module pass the name of itself, but I was hoping there would be a better work around then that, it's a lot of code I'd have to change.


Messages In This Thread
ME HMVC + custom library + fetch_module() does not work right - by El Forum - 04-19-2011, 07:13 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.