CodeIgniter Forums
[solved] Modules: Loading helpers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [solved] Modules: Loading helpers (/thread-24446.html)



[solved] Modules: Loading helpers - El Forum - 11-10-2009

[eluser]Buso[/eluser]
Is this supposed to work? (Im using Matchbox)

Code:
$this->load->helper('html');
$this->load->module_helper('users','html');

Im calling it from say, the 'blog' module, 'blog' controller.
(Im loading both, the html helper from 'blog' and the html helper from 'users')

MY_html_helper.php is in module users/helpers/



Its working for views, but not for helpers:

Fatal error: Call to undefined function login() in [..]modules\users\views\login.php on line 3



edit: problem solved. Here's the solution:

Code:
$this->load->helper('html');
$this->load->module_helper('users','MY_html');



[solved] Modules: Loading helpers - El Forum - 11-10-2009

[eluser]mattpointblank[/eluser]
I've never seen the word 'module' in CI terminology - do you mean models? Even if 'module' is valid, the normal CI structure is using an array, eg:

Code:
$this->load->model(array('model1', 'model2'));



[solved] Modules: Loading helpers - El Forum - 11-10-2009

[eluser]Buso[/eluser]
oh Im sorry I forgot to mention it, Im using Matchbox extension.

http://codeigniter.com/wiki/Matchbox/


[solved] Modules: Loading helpers - El Forum - 11-10-2009

[eluser]Phil Sturgeon[/eluser]
Im not sure if extended helpers within modules works. It should, but its the sort of thing I can see being a bug. Change the file name to html_helper.php and see what happens.


[solved] Modules: Loading helpers - El Forum - 11-10-2009

[eluser]Buso[/eluser]
ok, now I have tried to load only the helper from the 'users' module and it worked..

but i also need the helper from the other module, isn't there a way to have them both working? The name of the functions are different, so it's not a overriding problem.



edit: problem solved. Here's the solution:

Code:
$this->load->helper('html');
$this->load->module_helper('users','MY_html');