Loads a config file (an alias for CI_Config::load()).
public config ( string $file, boolean $use_sections = FALSE, boolean $fail_gracefully = FALSE ) : boolean | ||
$file | string | Configuration file name |
$use_sections | boolean | Whether configuration values should be loaded into their own section |
$fail_gracefully | boolean | Whether to just return FALSE or display an error message |
Résultat | boolean | TRUE if the file was loaded correctly or FALSE on failure |
/** Load a module config file **/ public function config($file = '', $use_sections = FALSE) { $file == '' and $file = 'config'; if (in_array($file, $this->config->is_loaded, TRUE)) { return $this->config->item($file); } list($path, $file) = Modules::find($file, $this->_module, 'config/'); if ($path === FALSE) { parent::config($file, $use_sections); return $this->config->item($file); } if ($config = Modules::load_file($file, $path, 'config')) { /* reference to the config array */ $current_config =& $this->config->config; if ($use_sections === TRUE) { if (isset($current_config[$file])) { $current_config[$file] = array_merge($current_config[$file], $config); } else { $current_config[$file] = $config; } } else { $current_config = array_merge($current_config, $config); } $this->config->is_loaded[] = $file; unset($config); return $this->config->item($file); } }
/** * Loads a config file * * @param string * @param bool * @param bool * @return void */ public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { // Detect module if (list($module, $class) = $this->detect_module($file)) { // Module already loaded if (in_array($module, $this->_ci_modules)) { return parent::config($class, $use_sections, $fail_gracefully); } // Add module $this->add_module($module); // Let parent do the heavy work $void = parent::config($class, $use_sections, $fail_gracefully); // Remove module $this->remove_module(); return $void; } else { parent::config($file, $use_sections, $fail_gracefully); } }