Welcome Guest, Not a member yet? Register   Sign In
create dynamic variable in config.php
#4

[eluser]CroNiX[/eluser]
You can't because config loads very early on in the bootstrap process and the db object isn't available yet. See /core/CodeIgniter.php to see how and the order that the CI objects are loaded/used.

I would create a base controller, MY_Controller, and set your lang def there in the __construct(). Then have all of your other controllers extend that base controller instead of CI_Controller so it will be available to everything (including your database).

You also might be able to using a hook, but I think that would be pretty inefficient for this.


Messages In This Thread
create dynamic variable in config.php - by El Forum - 02-26-2013, 04:25 AM
create dynamic variable in config.php - by El Forum - 02-26-2013, 07:51 AM
create dynamic variable in config.php - by El Forum - 02-26-2013, 08:03 AM
create dynamic variable in config.php - by El Forum - 02-26-2013, 09:31 AM
create dynamic variable in config.php - by El Forum - 02-27-2013, 02:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB