Welcome Guest, Not a member yet? Register   Sign In
Connect database application/core/MY_Config
#1

(This post was last modified: 06-28-2015, 06:44 PM by Wong.)

Hello,

I need some help, I store default language in database I need to connect database in application/core/MY_Config for get some value from database for set config item and save that value to session.

Those step must to be happen before application/core/MY_Lang load.

I try coding below it's not working. What should I do ?

Code:
class MY_Config extends CI_Config {

   var $CI;

   public function __construct(){
       parent::__construct();

       $this->CI  =& get_instance();

   }

}
Reply
#2

You usually don't need to override the CI_Config class to get the language information from the database in time to have it set for loading language files. In your base controller, get the language from the database before you load any language files and call
Code:
$this->config->set_item('language', $languageFromDb);
Reply
#3

Thank you
Reply




Theme © iAndrew 2016 - Forum software by © MyBB