CodeIgniter Forums
[SOLVED] - Show or Hide Debug Bar - 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: [SOLVED] - Show or Hide Debug Bar (/showthread.php?tid=77638)



[SOLVED] - Show or Hide Debug Bar - nc03061981 - 09-28-2020

Dear,

How to show / hide Debug Bar in app
(Default: Debug Bar show when I set CI_ENVIRONMENT = development)

Now I want show or hide in coding (not in .evn)

Thanks for help


RE: Show or Hide Debug Bar - captain-sensible - 09-29-2020

i mostly ignore the .env i just use he line :

Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';

in index.php located in public directory

i mostly ignore the .env i just use he line :

Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';

in index.php located in public directory

when you change 'development' to 'production' bottom bar disappears


RE: Show or Hide Debug Bar - nc03061981 - 09-29-2020

Dear captain-sensible,
Can i set it in case:

Code:
if ($role == 'admin')
{
    $_SERVER['CI_ENVIRONMENT'] = 'development';
}



RE: Show or Hide Debug Bar - InsiteFX - 09-29-2020

Yes you can.


RE: Show or Hide Debug Bar - nc03061981 - 09-29-2020

(09-29-2020, 01:57 AM)InsiteFX Wrote: Yes you can.

Thanks thanks hehe

Dear,

Set
Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';

It not working


RE: Show or Hide Debug Bar - captain-sensible - 09-29-2020

make sure that either you don't use .env or that values don't clash between direct editing in php and the .env

thats why i ignore .env because i probably won't remember I have values set in .env and others direct in php code

I changed in index.php located public dir

Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';

to

Code:
$_SERVER['CI_ENVIRONMENT'] = 'production';

and back & it definitely works .


RE: Show or Hide Debug Bar - nc03061981 - 09-29-2020

(09-29-2020, 04:39 AM)captain-sensible Wrote: make sure that either you don't use .env or that values don't clash between direct editing in php and the .env

thats why i ignore .env because i probably won't remember I have values set in .env and others direct in php code

I changed in index.php located public dir

Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';

to

Code:
$_SERVER['CI_ENVIRONMENT'] = 'production';

and back & it definitely works .

Thanks for help
Now it working fine
Kaka


RE: Show or Hide Debug Bar - Gary - 10-02-2020

There is also the possibility of removing it (whilst still in the development environment, and on-the-fly in one's active code, if that floats your boat) using settings in \Config\Filters.php:

Code:
public $globals = [
    'before' => [
      ...
    ],
    'after'  => [
      ...
    'toolbar', // <= comment this or remove it from $globals to disable the debug toolbar
    ]