Welcome Guest, Not a member yet? Register   Sign In
Calling models from helpers

Is there any way of calling functions in models from a helper?

Or alternatively, what would be the best way of having some code (for a dynamic menu) accessible by lots of different controllers?


1) if you load the helper, the functions will be available in every place

2) you can extend your controller class defining a library MY_Controller or using a hook

$CI = &get;_instance();

Perfect! Thanks ReGeDa.

The first line did throw an error in Hebrew (!!!) with the semi-colon in:

Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM in D:\WebSites\SilverMine\system\application\helpers\cart_helper.php on line 5

it's problem of forum post. you can try it by yourself. write in form post "&get;_instance();" without ';' and you will have with ';'

Hint: Use &/amp/; minus the slashes ie:


Sorry, doesn't work in code blocks. Sad

Theme © iAndrew 2016 - Forum software by © MyBB