[eluser]Arrow768[/eluser]
I solved the Problem:
hooks/Load_items.php
Code:
<?php if ( !defined('BASEPATH') ) exit('No direct script access allowed');
/*
This hook function is responsible for reading all of the settings from
the database into the config array so they can be accessed in controllers
and views with $this->config->item('whatever'); or config_item('whatever');
*/
class MY_Load extends CI_Controller{
function Load_items()
{
$CI =& get_instance();
//var_dump($CI);
$results = $CI->db->get('settings')->result();
foreach ($results as $setting) {
$CI->config->set_item($setting->id, $setting->value);
}//End of foreach
}
}
?>
config/hooks.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://ellislab.com/codeigniter/user-guide/general/hooks.html
|
*/
$hook['pre_controller'] = array(
'class' => 'MY_Load',
'function' => 'Load_items',
'filename' => 'Load_items.php',
'filepath' => 'hooks',
);
/* End of file hooks.php */
/* Location: ./application/config/hooks.php */