I need to autoload a CodeIgniter library with parameters. How?
Most CI system libraries have an “initialize” method. Passing an array to this method will override object properties, for example:
$this->load->library('email');
$params['smtp_port'] = 25;
$this->email->initialize($params);
Source: http://bit.ly/MS1yXK
Create a config array and pass it with the loading of the library Here is an example of facebook library...
$fb_config = array(
'appId' => 'YOUR_APP_ID_HERE',
'secret' => 'YOUR_APP_SECRET_HERE'
);
$this->load->library('facebook', $fb_config);
Create a config file library.php in this case (facebook.php) in application/config
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['appId'] = 'YOUR_APP_ID_HERE';
$config['secret'] = 'YOUR_APP_SECRET_HERE';
Load it in your controller and use it in your view accordingly