CodeIgniter Forums
Loading Models From library classes - 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 From library classes (/showthread.php?tid=14552)



Loading Models From library classes - El Forum - 01-06-2009

[eluser]Aidy[/eluser]
Hi Everyone

Sorry if this is a dumb question

Would it be possible to load and use a model in a library class and if so would it be appropriate?

Please enlighten me..


Loading Models From library classes - El Forum - 01-06-2009

[eluser]JoostV[/eluser]
Yes, it is possible.
Code:
// Instantiate the CI libraries so we can work with them
$CI =& get_instance();

$CI->load->model('somemodel');

In my opninion it can certainly be appropriate, if your library needs to fetch data from te database, for instance.


Loading Models From library classes - El Forum - 01-06-2009

[eluser]Aidy[/eluser]
Thanks JoostV

Very much appreciated