CodeIgniter Forums
Enable profiler - 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: Enable profiler (/showthread.php?tid=55212)



Enable profiler - El Forum - 10-15-2012

[eluser]ninjayan[/eluser]
Hi everyone! So its me again.

I have this code in my controller
Code:
public function __construct() {
  parent::__construct();
  $this->output->enable_profiler(TRUE);
  $this->clear_cache();

  if ($this->session->userdata('is_logged_in') && ($this->session->userdata('is_logged_in') == 1)) {
   redirect('site/dashboard');
  }
}
When I try to login, nothing works but if I remove
Code:
$this->output->enable_profiler(TRUE);
It works fine. How can I fix that? What is the problem?


Enable profiler - El Forum - 10-16-2012

[eluser]Aken[/eluser]
You'll need to be more specific about "nothing works".


Enable profiler - El Forum - 10-16-2012

[eluser]ninjayan[/eluser]
Sorry.
If I click the login (function at the same controller) nothing happens.


Enable profiler - El Forum - 10-16-2012

[eluser]CroNiX[/eluser]
Are you using ajax? If you use ajax with the profiler running it will append all of the profiler data/html to the end of the ajax request (actually, any request), ruining anything returned.

If this is your case, I usually do:
Code:
if ( ! $this->input->is_ajax_request())
{
  $this->output->enable_profiler(TRUE);
}



Enable profiler - El Forum - 10-16-2012

[eluser]ninjayan[/eluser]
Yes I'm using ajax. Will try your input. Thanks!