Is there a way to turn off the debugbar for a specific controller/route |
As the title says, im seeking a way to disable the debugbar for specific controllers/routes.
Thank you.
The debugbar only shows in development mode if you change to production it
will not show. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thank you InsiteFX, I know this already, but that doesnt help during development
![]() I've came up with a solution, I've basically placed the following code in the Config/Boot/development.php file just above the CI_DEBUG definition: PHP Code: if (!empty($_SERVER['REQUEST_URI']) && substr($_SERVER['REQUEST_URI'], 0, 5 ) === "/css/") Not sure if it is the best way, but it works.
Hey crazyR - the Toolbar is attached via controller filter, so you can change the way it's specified to exclude certain uri's there. See the filters docs for more info.
Thank you kilishan, That is exactly what I was looking for
![]() I did brush pass that documentation earlier but for some reason I must not have been paying enough attention to realize its importance. Thanks again.
@crazyR
> As the title says, im seeking a way to disable the debugbar for specific controllers/routes. I am not sure of the order that CI_DEBUG is called but I prefer defining the debug boolean constant in index.php. You could try a conditional grouping of the /Controller/config/routes.php -> $route1 = "route"; and the debug constant will be contained in the same file. (11-06-2019, 07:43 AM)crazyR Wrote: As the title says, im seeking a way to disable the debugbar for specific controllers/routes. For me, this is working: before showing the view create a session var: PHP Code: session()->set('skip_debug',true); then in the app\Config\Toolbar.php create a constructor then remove the View::class if that var is present. PHP Code: public function __construct() {
Simplest and cleanest solution based on Filters - Except for a Few URIs documentation (working on CI 4.6.0).
In Filters.php, move 'toolbar' from $required['after'] to $globals['after'] and add 'except' with desired relative URI to it as in the example below. app/Config/Filters.php PHP Code: // ... You can add one URI as a string, or multiple URIs as an array of strings. PHP Code: 'toolbar' => ['except' => 'relative_uri/*'], PHP Code: 'toolbar' => ['except' => ['relative_uri/*', 'another_relative_uri/*']], |
Welcome Guest, Not a member yet? Register Sign In |