Welcome Guest, Not a member yet? Register   Sign In
database driver config file

Hello CI Coders,
I was wondering if there was a way to make ./system/application/config/config.php database driven. I am writing an application in CI that can handle more than one website on a single CI application installation. The problem with this is that I need to change configuration values based on the user's website.

Any ideas?

Depends on what you want to modify.

You don't have the database and full CI functions available until the constructor of your (MY) controller (actually, as of the post-controller-hook). Some of the config values are used by the classes that are loaded as part of the startup process, like URI, Router, Input, and Output.

I want to modify every value of the config file. That is why I need the database. I have successfully done this by rewriting the ./system/libraries/router.php, however I wanted to do in ./system/libraries/config.php any ideas?

You're rewriting system files? Yikes...

You can load these values post-controller-constructor like WanWizard suggests, or load the database in a pre-system hook, or just put it in the constructor of a MY_Controller... Almost any solution is a better one than rewriting system files.

Theme © iAndrew 2016 - Forum software by © MyBB