gjb2048 / moodle-theme_essential

The Essential Moodle Theme
https://gjb2048.github.io/moodle-theme_essential/
GNU General Public License v3.0
91 stars 120 forks source link

Display PHP debug messages at the footer #604

Open nadavkav opened 8 years ago

nadavkav commented 8 years ago

How about this... https://github.com/moodlerooms/moodle-theme_snap/blob/master/config.php#L26-L31

gjb2048 commented 8 years ago

What does it look like when it happens?

gjb2048 commented 8 years ago

And what else do I need to do besides the config? As clearly that is indicating some markup to the PHP scripting engine. Is there anything else to add in the actual layout file?

nadavkav commented 8 years ago

It seems like they are using the class just for getting to the div and moving it to the bottom https://github.com/moodlerooms/moodle-theme_snap/blob/master/javascript/snap.js#L112-L129

nadavkav commented 8 years ago

Here is how it looks: image

nadavkav commented 8 years ago

The JS moves the xdebug-error from the head of the page to the footer, which is nicer and more easy to read. (as the top main toolbar always hides some of the php errors)

gjb2048 commented 8 years ago

Thanks Nadav. Ok, title changed from JS to PHP as that's what the error message does. All the code does is move the error messages from one place to another and leaves an alert with link at the top. Also has extra code for xdebug when being used. Tricky to test as I've never got xdebug working.

nadavkav commented 8 years ago

How can you work without xdebug? I do not know if I could figure out Moodle without it. (The grades, backup, quiz, ...)

gjb2048 commented 8 years ago

error_log(print_r($thing, true));

nadavkav commented 8 years ago

Seriously? no line by line debug to see the change in variable values? no function call stack? no drilling into classes and arrays? no way

gjb2048 commented 8 years ago

print_r does objects and arrays. a structured walkthrough does the call stack / any error. Change in variable values by reading the code.

gjb2048 commented 8 years ago

Looking at again, this: https://github.com/moodlerooms/moodle-theme_snap/blob/master/config.php#L26-L31 is a server side session thing and nothing to do with the JS and moving the debug message.

No idea of how much time would take to implement and test. Open for negation and reasoning why this should be done.

nadavkav commented 8 years ago

Well... the code moved (since the time I linked to it on master) Here is the correct piece of code: https://github.com/moodlerooms/moodle-theme_snap/blob/master/config.php#L34-L39