Welcome Guest, Not a member yet? Register   Sign In
How to enable debug toolbar in CI4.0.0-rc.3
#19

(This post was last modified: 01-17-2020, 03:18 PM by Gary.)

(01-17-2020, 12:33 PM)Gary Wrote:
(11-15-2019, 09:11 AM)hbonds Wrote: I have set environment to development through .htaccess file using code
 
Code:
SetEnv CI_ENVIRONMENT development

environment is successfully set to development, but I am still not able to see debug toolbar.
How can I see debug toolbar on application?


Just to clarify... since, re-reading my previous post, I suspect it will be too easy to believe that the problem is the undefined variable... when it's really the way the the undefined variable is tested/checked.  If one uses a test like isset(), then the problem also seems to go away.


Gary

(01-17-2020, 03:06 PM)JNapolitanoIT Wrote: Hey there.

May I add my two cents on this topic. First off, might I suggest that instead of using the following code block to access/manipulate session data:

Code:
    ....
    if (isset($_SESSION['user_session'])) {
      $user_session = TRUE;
    }
    ....

that you use the built-in session library instead. This way you don't have to worry too much about sessions closing early, or not at all, or not on time, etc. The session library was built to do the heavy lifting for you so you don't have to worry about anything else.

For example, the way to do this is to call the Session services helper function like so:
'
Code:
$session = session();

No you can access your session data easily. Reformatting your code from before to utilize this would look like the following:

Code:
    ....
    if (isset($session->get('user_session'))) {
      $user_session = TRUE;
    }
    ....

    // OR

    ....
    if (isset($session->user_session)) {
      $user_session = TRUE;
    }
    ....

You can read more about it here. The reason I bring this up is because the way you're accessing session data could impact the debug toolbar. For example, see here. Also it is always best to utilize the frameworks built-in libraries for consistency across your application. After this, you may want to make sure your write permissions are properly set for the following directory:

Code:
writable/debugbar/

I hope this helps you out and I am not talking out of my hind-end Tongue

Brilliant!  Thanks JNapolitanoIT... I had just started with my experimenting with sessions, which is why I needed the toolbar, and then noticed I'd manage to break it... so now that I'm back up and running and about to pick up where I left off on sessions, your pointers are perfectly timed.

Gary
Reply


Messages In This Thread
RE: How to enable debug toolbar in CI4.0.0-rc.3 - by Gary - 01-17-2020, 03:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB