Loading models in helpers. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Loading models in helpers. (/showthread.php?tid=28747) |
Loading models in helpers. - El Forum - 03-20-2010 [eluser]ram4nd[/eluser] I want to load a model in helper, but I have recursive function and it loads the model 100 times again and again if I load that page. How can I take the loading out of mu funcion. My helper: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Loading models in helpers. - El Forum - 03-20-2010 [eluser]LifeSteala[/eluser] For your situation, I highly suggest you autoload this model. Open ../application/config/autoload.php and add the model in there. Loading models in helpers. - El Forum - 03-20-2010 [eluser]ram4nd[/eluser] Ok, but maybe someone has better idea. Loading models in helpers. - El Forum - 03-20-2010 [eluser]jalalski[/eluser] Well, it should be: $CI =& get_instance(); for a start... |