Welcome Guest, Not a member yet? Register   Sign In
global profiling enable/disable
#8

[eluser]Unknown[/eluser]
First of all, create a file named profiler.php in application/hooks directory:

Code:
<?php
// profiler.php
class MY_Profiler
{
    private $CI;
    
    public function enable()
    {
        $this->CI =& get_instance();
        
        $this->CI->output->enable_profiler(TRUE);
    }
}

Second of all, add the following to your application/config/hooks.php file:

Code:
$hook['post_controller'] = array(
    'class'    => 'MY_Profiler',
    'function' => 'enable',
    'filename' => 'profiler.php',
    'filepath' => 'hooks'
);

Finally, edit your application/config/config.php file as:

Code:
$config['enable_hooks'] = TRUE;


What just happened?
We have created a hook, that runs after the controller run. (see more) The hook just enables the profiler, and you do not have add enable_profiler(TRUE) to all of your controllers.

To Disable Profiler
If you decide to disable the profiler, you just comment out the part you added to file applications/config/hooks.php


Messages In This Thread
global profiling enable/disable - by El Forum - 04-10-2010, 03:08 AM
global profiling enable/disable - by El Forum - 04-10-2010, 05:30 AM
global profiling enable/disable - by El Forum - 04-10-2010, 06:27 AM
global profiling enable/disable - by El Forum - 04-10-2010, 12:12 PM
global profiling enable/disable - by El Forum - 04-10-2010, 12:14 PM
global profiling enable/disable - by El Forum - 04-10-2010, 03:24 PM
global profiling enable/disable - by El Forum - 04-10-2010, 06:53 PM
global profiling enable/disable - by El Forum - 07-15-2011, 05:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB