CodeIgniter Forums
Problem changing config item in My_Controller - 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: Problem changing config item in My_Controller (/showthread.php?tid=57955)



Problem changing config item in My_Controller - El Forum - 04-29-2013

[eluser]spmckee[/eluser]
Greetings,

Im trying to change a config item via my back-end admin settings. In "My_Controller" I have
Code:
$this->output->enable_profiler(Settings::get('my_enable_profiler'));
that doesn't work.


Here's the break-down:
Code:
echo  Settings::get('my_enable_profiler');  //TRUE

// Works
$this->output->enable_profiler(TRUE);

// Doesn't work
$this->output->enable_profiler(Settings::get('my_enable_profiler'));

//Even tried "(boolean)" but didn't work
$this->output->enable_profiler((boolean)Settings::get('my_enable_profiler'));

If my echo gets the same result as typing it i, why doesn't it work?

Thanks,
SP





Problem changing config item in My_Controller - El Forum - 04-29-2013

[eluser]TheFuzzy0ne[/eluser]
Are you absolutely certain it's returning TRUE like you think? Perhaps you should try a var_dump()? The reason I ask, is that's the only reason I can think of why it wouldn't work.

The only other thing I can think of, is that you're calling it too late in your script, but that's quite unlikely. Is this code within your controller constructor?


Problem changing config item in My_Controller - El Forum - 04-29-2013

[eluser]spmckee[/eluser]
Thanks Fuzzy.

Code:
var_dump(Settings::get('my_enable_profiler'));     //string(4) "TRUE"

It lives in
Code:
public function MY_Controller() {

        parent::__construct();

   ....


};



Problem changing config item in My_Controller - El Forum - 04-30-2013

[eluser]TheFuzzy0ne[/eluser]
I'm baffled. I'd suggest copying ./system/core/Output.php to ./application/core/Output.php, (and maybe the same with the profiler) then you can add some debugging code, and hopefully trace the problem back to the source. Sorry, but that's the best I can come up with. I'm totally baffled by this.