Conf v1.0 - Database Configuration done right |
[eluser]tdktank59[/eluser]
Conf History: After doing some research it is impossible to just extend the CI_Config class and not have some redundant code. And more of a hack then a proper solution. So after some thinking and planning I came to a solution. Step 1. Modify the auto loader to allow you to set a object name for any library loaded. Note: $this->load->library() supports it so why shouldn't the autoloader? Step 2. Modify the CI_Config class to allow the user of database or file configurations. Step 3. Setup the autoloader to load the conf.php and assign it to $this->config instead of $this->conf basically overwriting the CI_Config. So heres the result! Everything should just be drop in and should not destroy any existing functionality since I setup the db loading to fail to file loading and just log a message saying it did so. How to Use: Autoload: Load like normal, or with a new name Code: $autoload['library'] = array('database','conf'=> array('name'=>'config')); Database Structure: You can have as many database tables as you want, by default there is a prefix of "config_" on any table you use. However you can change this. (see below) Just change table to what ever you would normally create a file for. Code: CREATE TABLE IF NOT EXISTS `config_table` ( Turning on/off DB Config: Code: $this->use_db(TRUE/FALSE); Code: $this->use_db(TRUE)->load('config'); Setting Prefix/Suffix: Code: $this->set_prefix($prefix); Code: $this->set_suffix($suffix); Otherwise the rest of the functionality is the same! Download Database Config V1.0 User Guide Database Config User Guide Let me know if you have any problems and I will fix them asap Also let me know if you would like additional features. I set it up to behave like the traditional config class. A few things some might like are the ability to save the file to the database. (good for development since you can set the file how you want it and import it straight to the database) updating and saving values on the fly.
|
Welcome Guest, Not a member yet? Register Sign In |