Welcome Guest, Not a member yet? Register   Sign In
How to call a library from a library
#1

[eluser]skunkbad[/eluser]
I've got one library in my system/application/libraries directory, and right now I can call another library, but I am forced to put the library in the system/libraries directory. I'd like to be able to have it in my application/libraries directory, and wondering what I can change to accomplish that. Here's what I have now:

Code:
$this->CI = get_instance();
$this->CI->load->library('search');
#2

[eluser]Thorpe Obazee[/eluser]
[quote author="skunkbad" date="1245401652"]

Code:
$this->CI =& get_instance();
$this->CI->load->library('search');
#3

[eluser]skunkbad[/eluser]
Hmm... I had something else screwed up, because now it is working with my code
#4

[eluser]TheFuzzy0ne[/eluser]
Don't forget the ampersand in there, otherwise I don't think you'll actually have the CodeIgniter super Object by reference. Instead you'd probably end up with a copy.
#5

[eluser]Phil Sturgeon[/eluser]
The "&" only matters if you are using PHP 4. PHP 5 does this automatically I believe.
#6

[eluser]Dam1an[/eluser]
I think you're right, cause I tried (out of curiosuty) to get_instance without the & several times, but it never increased my memory usage
#7

[eluser]n0xie[/eluser]
In PHP5, all objects are passed by reference.
#8

[eluser]skunkbad[/eluser]
I knew of this difference, php5 and php4 with the &. I think the issue was that I was reading the error incorrectly. It's all good now.




Theme © iAndrew 2016 - Forum software by © MyBB