Access Database in Core class |
I'm trying to make a site multilanguage.
We use diffent .json files with the translation of every term according to de language wich can be the set in a cookie or can be the default language. I changed .htaccess file so when we get something like http://siteurl/en/controller/action it would rewrite to http://siteurl/controller/action?__lang=en, this works perfectly The problem appeared when i had to set the new base_url, because the available languages can be eddited by an administrator, so I proceed to create a new controller in the application/core folder in wich i changed the base_url with the cookie value or the default language But i had to use a mysqli object, write user and password again, and I didnt like that but I cant use the DB because core classes instances are created long before $CI is created so no "instance" is available for &get_instance(). Any help or idea to make this cleaner? Heres my code: PHP Code: class MY_Config extends CI_Config { |
Messages In This Thread |
Access Database in Core class - by LPena - 01-05-2020, 07:48 AM
RE: Access Database in Core class - by jreklund - 01-05-2020, 11:16 PM
RE: Access Database in Core class - by keklein - 01-06-2020, 10:21 AM
RE: Access Database in Core class - by customy - 04-15-2020, 03:15 AM
RE: Access Database in Core class - by ZoeF - 01-09-2020, 03:32 PM
RE: Access Database in Core class - by maxedip556 - 02-17-2020, 03:22 AM
|