Welcome Guest, Not a member yet? Register   Sign In
Extending CI_Config class problem
#1

[eluser]gigowski[/eluser]
I am writing my own shopping cart application, actually rewriting it for CI. I was attempting to create a config subclass as shown here. I followed the instructions in the user guide, Creating Your Own Libraries. I keep getting the following error:

Fatal error: Cannot redeclare class ci_config in /homepages/42/d187750613/htdocs/lilcharacters/system/libraries/Config.php on line 29

The name of my subclass is MY_Config and the filename is MY_Config.php and it's saved in the system\application\libraries folder. If I change the name of the file I get a message telling me it can't find the file. Does anyone know why this is happening? I call the MY_Config file up like so:

Code:
class Shop extends Controller {

        function Shop() {
             parent::Controller();
             $this->load->library('config');
             $this->config->db_config_fetch();
             $this->load->model('Shopmodel');
             $this->load->library('shop_lib');
        }
}

Here is the MY_Config.php code:

Code:
<?php
class MY_Config extends CI_Config {
    function MY_Config()
    {
        parent::CI_Config();
    }
    
    function db_config_fetch()
    {
        $CI =& get_instance();
        $query = $CI->db->get($this->item('dbt_site_config'));
        
        foreach ($query->result() as $row)
        {
            $this->set_item($row->config_key, $row->config_value);
        }
        
    }
    
}
?>

Any help would be greatly appreciated.


Messages In This Thread
Extending CI_Config class problem - by El Forum - 12-19-2007, 08:24 PM
Extending CI_Config class problem - by El Forum - 12-19-2007, 08:57 PM
Extending CI_Config class problem - by El Forum - 12-19-2007, 10:18 PM
Extending CI_Config class problem - by El Forum - 12-19-2007, 11:06 PM
Extending CI_Config class problem - by El Forum - 12-19-2007, 11:26 PM
Extending CI_Config class problem - by El Forum - 12-19-2007, 11:49 PM
Extending CI_Config class problem - by El Forum - 12-20-2007, 05:21 AM
Extending CI_Config class problem - by El Forum - 12-20-2007, 10:19 AM
Extending CI_Config class problem - by El Forum - 12-20-2007, 03:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB