CodeIgniter Forums
Get $active_group? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Get $active_group? (/thread-18007.html)

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

I don't think there's any sensible way to do it, other than to do this:

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

No such luck I'm afraid...

Get $active_group? - El Forum - 04-22-2009

Could you not do something like
$config['active_group'] = "default";

$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:-

$CI =& get_instance();
$active_group = $CI->config->item('active_group');

Inside database.php to be able to access the config variables.