![]() |
Best way to load config variables from database - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Best way to load config variables from database (/showthread.php?tid=4073) |
Best way to load config variables from database - El Forum - 11-05-2007 [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' ); I hope you got my point ![]() Stefan Best way to load config variables from database - El Forum - 11-06-2007 [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'); Best way to load config variables from database - El Forum - 11-06-2007 [eluser]Eric Barnes[/eluser] You could also use the pre_controller hook to have this automatically called. |