Welcome Guest, Not a member yet? Register   Sign In
$this->load->library and __construct
#2

[eluser]Pascal Kriete[/eluser]
$this->load->library instantiates the class and saves a reference as $this->class_name (basically creating a singleton).

What you can do is this:
Code:
$config = array(
    'api_key'    => 'lkjiojef',
    'secret'    => 'iopuqr'
);
$this->load->library('whatever', $config);

/* Later on */
$this->whatever->some_method();

Your constructor will get that array as it's first parameter. If you need more instances you can use new, but in that case you'll obviously need to pass the array manually.


Messages In This Thread
$this->load->library and __construct - by El Forum - 09-08-2008, 09:23 AM
$this->load->library and __construct - by El Forum - 09-08-2008, 09:46 AM
$this->load->library and __construct - by El Forum - 09-08-2008, 09:50 AM
$this->load->library and __construct - by El Forum - 09-08-2008, 09:53 AM
$this->load->library and __construct - by El Forum - 09-08-2008, 10:36 AM
$this->load->library and __construct - by El Forum - 09-08-2008, 10:59 AM
$this->load->library and __construct - by El Forum - 09-08-2008, 01:49 PM
$this->load->library and __construct - by El Forum - 03-02-2009, 09:08 PM
$this->load->library and __construct - by El Forum - 03-02-2009, 11:03 PM
$this->load->library and __construct - by El Forum - 03-03-2009, 03:21 AM
$this->load->library and __construct - by El Forum - 03-03-2009, 04:32 AM
$this->load->library and __construct - by El Forum - 03-03-2009, 05:03 AM
$this->load->library and __construct - by El Forum - 03-03-2009, 06:24 AM
$this->load->library and __construct - by El Forum - 03-03-2009, 06:39 AM
$this->load->library and __construct - by El Forum - 03-03-2009, 06:51 AM
$this->load->library and __construct - by El Forum - 03-03-2009, 07:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB