• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

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