Loading DB Class in Helpers |
[eluser]pmonty[/eluser]
I am sure this is as obvious as the nose on my face, but how do I implement loading the DB class in a helper function? Paul
[eluser]Référencement Google[/eluser]
$CI =& get_instance(); $CI->load->model('your_model');
[eluser]tonanbarbarian[/eluser]
Utilizing CodeIgniter Resources within Your Library works for helpers and plugins as well
[eluser]pmonty[/eluser]
Thanks, all. That is exactly what I was looking for. Paul
[eluser]pmonty[/eluser]
Well, trying to implement this, I am still having some problems. Here is my code. Code: CI =& get_instance(); Can anyone see why this returns the PHP Error Quote:An Error Was Encountered Paul
[eluser]pmonty[/eluser]
Just a typo in the post. It is there in my code but generating the error as noted. Corrected and as in my helper code: Code: $CI =& get_instance(); Paul
[eluser]xwero[/eluser]
The database class isn't loaded as a library, it has its own load method Code: $CI->load->database(); // loads default group I think you mixed up a few things in your snippet
[eluser]pmonty[/eluser]
Yup, Thanks Xwero. I was confusing sample language from the docs with how to actually implement the call. Your examples did it. Thanks again. paul |
Welcome Guest, Not a member yet? Register Sign In |