[eluser]WanWizard[/eluser]
Create a file called menu_superfish.php in application/config, and in that, create a structure like
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* menu_superfish Configuration
*/
$config['keyA'] = 'valueA';
$config['keyB'] = 'ValueB';
Then create your library like
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Menu_superfish {
function Menu_superfish($params)
{
// process the parameters passed
if (is_array($params) && count($params) > 0)
{
foreach ($params as $key => $val)
{
// only load keys we have defined as class properties
// you might want to add more checks here
if ( isset( $this->$key )
{
$this->$key = $val;
}
}
}
}
}
?>
This allows you to load the library from autoload, or via $this->load->library(), and all config will be loaded from the config file.
Alternatively, you can do $this->load->library('menu_superfish', $config); where $config is an array similar to the one you define in the config file. This allows you to override a config file.