Is there a way to turn off the debugbar for a specific controller/route - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Is there a way to turn off the debugbar for a specific controller/route (/showthread.php?tid=74788) |
Is there a way to turn off the debugbar for a specific controller/route - crazyR - 11-06-2019 As the title says, im seeking a way to disable the debugbar for specific controllers/routes. Thank you. RE: Is there a way to turn off the debugbar for a specific controller/route - InsiteFX - 11-06-2019 The debugbar only shows in development mode if you change to production it will not show. RE: Is there a way to turn off the debugbar for a specific controller/route - crazyR - 11-06-2019 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. RE: Is there a way to turn off the debugbar for a specific controller/route - kilishan - 11-06-2019 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. RE: Is there a way to turn off the debugbar for a specific controller/route - crazyR - 11-06-2019 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. RE: Is there a way to turn off the debugbar for a specific controller/route - John_Betong - 11-06-2019 @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. RE: Is there a way to turn off the debugbar for a specific controller/route - tibszabo - 02-25-2021 (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() { |