Get $active_group? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Get $active_group? (/showthread.php?tid=18007) |
Get $active_group? - El Forum - 04-22-2009 [eluser]Jonas G[/eluser] Quick question: Is it possible to get the $active_group defined in databases.php somehow? Get $active_group? - El Forum - 04-22-2009 [eluser]TheFuzzy0ne[/eluser] I don't think there's any sensible way to do it, other than to do this: Code: include(APPPATH . 'config/database.php'); Then the $active_group variable will be available in the scope of the function where the file was included. Get $active_group? - El Forum - 04-22-2009 [eluser]Colin Williams[/eluser] I would print_r($this->db) and hunt for it. Might be somewhere in there. Get $active_group? - El Forum - 04-22-2009 [eluser]TheFuzzy0ne[/eluser] No such luck I'm afraid... Get $active_group? - El Forum - 04-22-2009 [eluser]Dam1an[/eluser] Could you not do something like Config: Code: $config['active_group'] = "default"; Database: Code: $active_record = $this->config->item('active_group'); And then you can just get the value via the config class (Note: This has not been tested, but should work non the less) Get $active_group? - El Forum - 07-08-2011 [eluser]Rob Corley[/eluser] I just tried the above, and just for reference you need to do:- Code: $CI =& get_instance(); Inside database.php to be able to access the config variables. |