Welcome Guest, Not a member yet? Register   Sign In
[solved] Modules: Loading helpers
#1

[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');
#2

[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'));
#3

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

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

[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.
#5

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




Theme © iAndrew 2016 - Forum software by © MyBB