[eluser]Ethan Dunham[/eluser]
I am a bit embarrassed because I am a merely a designer posing as a php developer. %-P Anyway here's what I did:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Modular Extensions loader class extension
*
* install this file as application/libraries/MX_Loader.php
*
**/
class MX_Loader extends Loader
{
/** Load a module config file **/
public function module_config($file = '', $use_sections = FALSE, $module = NULL)
{
$ci = modules::$registry[$this->_class];
$module = ($module == NULL ? $this->_module : $module);
$file = (empty($file)) ? 'config' : $file;
// prepend the name of the module to the actual filename
$loadedfilename = $module ."_". $file;
if (in_array($loadedfilename, $ci->config->is_loaded, TRUE))
return $ci->config->item($loadedfilename);
list($path, $file) = modules::find($file, $module, 'config/');
if ($path === FALSE)
{
self::$loader->module_config($file, TRUE, $module);
return $ci->config->item($loadedfilename);
}
if ($config = modules::load_file($file, $path, 'config'))
{
/* reference to the config object */
$current_config =& $ci->config->config;
if ($use_sections === TRUE)
{
if (isset($current_config[$loadedfilename]))
{
$current_config[$loadedfilename] = array_merge($current_config[$loadedfilename], $config);
}
else
{
$current_config[$loadedfilename] = $config;
}
}
else
{
$current_config = array_merge($current_config, $config);
}
$ci->config->is_loaded[] = $loadedfilename;
unset($config);
return $ci->config->item($loadedfilename);
}
}
}
Honestly not sure if this is 100% correct, but the changes I made work so far without issue. The key for me was to make sure the array that saved the names of the config files was unique. To do that I prepended the name of the module to the name of the config file and saved that as the name. Make sense?
Anyway, compare this to the ME config loader function to see the changes I made. Thanks, and suggestions welcome!
Ethan