Welcome Guest, Not a member yet? Register   Sign In
SQL code in a config file
#1

[eluser]zeedy2k[/eluser]
I want to make a custom config file but for it to grab the content from a database... so they can edit the config information from the web and store it in the database and then the config file calls it?? I would also like to do this for language files...

Hope this makes sense.
#2

[eluser]Crafter[/eluser]
I'm not quite sure of you are asking if you can do this or how you can do this.

The config files are loadded at a very early stage when CI is loading. You therefore don't have an instance of CI loaded and therefore your database libraries may not be accessible,

However, you can load your own config file at any time and loading database values should not be a problem.

I've not this but the best is to try it out for yourself. If your CI class is not available, you may have to load another instance (get_instance).
#3

[eluser]Wuushu[/eluser]
[quote author="Crafter" date="1200103754"]The config files are loadded at a very early stage when CI is loading. You therefore don't have an instance of CI loaded and therefore your database libraries may not be accessible[/quote]

Doesn't matter when they are loaded.. if it's 10 milliseconds or 10 minutes after CI has loaded..

1) Retrieve your stuff from database / edit / save ->
2) write a function that will write your "stuff" to myVerySpecialConfig.php
like so $config['key'] = value;
3) autoload myVerySpecialConfig.php


Not possible? Maybe, maybe not! Haven't tried!
#4

[eluser]tonanbarbarian[/eluser]
Basically answered something similar to this in my last post

Global Variables from database
#5

[eluser]nigelb[/eluser]
I found this thread $this->config->item not working in helper file which I think might work... function loaded $autoload[’config’] = array(’myconfig/config’); and then called




Theme © iAndrew 2016 - Forum software by © MyBB