2

I have a page where I'm calling several separate sections via ajax. When I am logged in each of these sections pull in their own "version" of the profiler and debugger.

Is it possible to disable in these sections while keeping it on for the main template?

5

You can do this if you're willing to programmatically manipulate hidden configuration variables in your config file ;-)

I use Focus Labs Master Config style configs, so I have this in my dev config:

$env_config['template_debugging']  = 'y';
$env_config['show_profiler']       = 'y';

And, obviously, you can set those to 'n' by-hand to turn off the debugger and profiler.

But, you also could set those values programmatically, inside of your own PHP conditional. In pseudo-code:

$env_config['template_debugging']  = 'y';
$env_config['show_profiler']       = 'y';

if ($currentURL === $myAjaxURL) {
  $env_config['template_debugging']  = 'n';
  $env_config['show_profiler']       = 'n';
}

I do manipulate site configs programmatically. It's obviously a place where you can accidentally knock your site offline, but if you are sufficiently careful and/or rube-goldberg-ish, the config files are just another place where you can program things via PHP.

If you don't use the Focus Labs Master Config style configs, you still can do this kind of thing in your config.php. You'll just use the proper EE hidden variable syntax:

$config['template_debugging']  = 'n';
$config['show_profiler']       = 'n';

One caveat, though: I don't know if EE will overwrite your code in the config.php if you go into the System Preferences (or, other admin) via the CP. You can always set your config.php permissions to read-only when you're doing this testing, to prevent EE overwriting it, if that does become an issue.

0

You cannot natively turn off profiling and debugging info in specific templates.

2
  • 2
    I use a small little custom plugin for this, called debug_override, and use it on a XML template. gist.github.com/GDmac/dae6bcce24b1c42d7fa1 – GDmac Jun 22 '14 at 8:55
  • 1
    @GDMmac - great little plugin there - just install it, pop {exp:debug_override override="ajax"} at the top of any template segment being pulled in by ajax and debugging is hidden for that chunk (but can still be swtiched on off for rest) - very handy, thanks! – Jeremy Daalder Oct 9 '14 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.