Welcome Guest, Not a member yet? Register   Sign In
Best way to load config variables from database
#1

[eluser]Escee[/eluser]
Hi y'all,

In my application I make use of an database with configuration table (key and value fields). Now I can autoload this by calling a model, library or even a helper if I want to. But is there an easier/nicer way to accomplish something like this (code) as somekind of autoload without calling a model or whatever, just the code?

Code:
get_db_table ( 'config' );

while ( records )
{
    make_config_item ( 'key', 'value' );
}

I hope you got my point Wink

Stefan
#2

[eluser]Derek Allard[/eluser]
you can autoload config files also. Open up system/config/autoload.php
Code:
$autoload['config'] = array();

After that, config items are available via
Code:
$this->config->item('item name');
#3

[eluser]Eric Barnes[/eluser]
You could also use the pre_controller hook to have this automatically called.




Theme © iAndrew 2016 - Forum software by © MyBB