CodeIgniter Forums
Classes in CodeIngniter - 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: Classes in CodeIngniter (/showthread.php?tid=27598)



Classes in CodeIngniter - El Forum - 02-15-2010

[eluser]ronn[/eluser]
I would like to create a class and place it in the CI library of my project. I have created a basic class and placed it in the libraries folder, but I'm unable to make it work in my controller. Does anyone know a tutorial covering this, or can offer any help?


Classes in CodeIngniter - El Forum - 02-15-2010

[eluser]nelson.wells[/eluser]
http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html

Read that. In addition, post your code and I can try to help.


Classes in CodeIngniter - El Forum - 02-16-2010

[eluser]mikelbring[/eluser]
You probably need to put $CI =& get_instance(); in your class if you need to use anything from CI. But you still should be able to load it in the controller with out that.