[eluser]RedFin[/eluser]
Hello Guys,
I'm new to CI and need a little help here. I have the following setup:
Code:
class MY_Controller extends CI_Controller {
which is most likely my Front-Controller loading all the important stuff i need later. In MY_Controller, there is stuff like:
Code:
$this->load->library('some-self-written-library');
print_r($this);
Now i want to retrieve the current CI-Object in one of my self-written libraries, e.g:
Code:
class some-self-written-library {
public function __construct()
{
//retrieve current framework instance
$CI =& get_instance();
$CI->load->library('encrypt');
If i now print_r $this (like shown above), there is the following "problem":
Code:
Company Object
(
[data:protected] => Array
(
)
[benchmark] => CI_Benchmark Object
(
[marker] => Array
(
[total_execution_time_start] => 0.20528900 1348497221
.
.
.
)
)
.
.
.
[encrypt] => CI_Encrypt Object
(
[CI] => Company Object
*RECURSION*
[encryption_key] =>
[_hash_type] => sha1
[_mcrypt_exists] =>
[_mcrypt_cipher] =>
[_mcrypt_mode] =>
)
)
where Company is the current Controller i was loading. Does that mean, that i have a complete new CI-Object IN the already existing CI-Object?
How can i solve this problem, or shorter: How can i access the current ci-instance in a self-written library without creating that kind of recursion. Any ideas?
I also noticed that this only happens if i load librarys inside of a self-written library.
How do i solve this, if i need libraries inside of libraries?
Kind regards
John.