Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4 Debug function #80

Open
crochefort opened this issue Jan 16, 2014 · 2 comments
Open

V4 Debug function #80

crochefort opened this issue Jan 16, 2014 · 2 comments
Labels

Comments

@crochefort
Copy link
Contributor

Patrick, I notice that if you are missing one file that is required, even if you add the report all error option on the top of the file you don't see any error anywhere.

Was working on the Mega Menu and was not able to get it working till I copy all the file from the demo menu folder in my new menu folder.

The menu was just gone.

So is it possible for you to setup a variable in the config to act as a debug option

So Debug ON you see all error
and Debug Off you don't see any error.

@upsonp
Copy link
Member

upsonp commented Jan 16, 2014

@michael-milette How do you handle it?

You have much more refined error reporting than I have. I have the same issue as @crochefort and don't see errors on my page. Might be part of the reason why some little things slip by me.

@michael-milette
Copy link
Contributor

Below is some code I came across that might help you. It's from http://motoma.io/turning-on-php-debugging-and-error-messages/. I slightly modified the code to fix errors (mostly brace issues).

     <?php
     $DEBUGGING = True;
     $TRACECOUNT = 0;

     if($DEBUGGING) {
         error_reporting(E_ALL);
         ini_set('display_errors', True);
     }

     function trace($message) {
         global $DEBUGGING;
         global $TRACECOUNT;
         if($DEBUGGING) {
             echo '<hr />;'.$TRACECOUNT++.'<code>'.$message.'</code><hr />';
         }
     }

     function tarr($arr) {
         global $DEBUGGING; 
         global $TRACECOUNT; 
         if($DEBUGGING) { 
             echo '<hr />'.$TRACECOUNT++.'<code>'; 
             print_r($arr); 
             echo '</code><hr />'; 
         } 
     } 

     ?>

Include it at the top of in your config/config.php file to enable debugging. In addition, you can call the trace() and tarr() functions within your code to help in your debugging efforts:

NOTE: One of the problems you might be having is a result of the use of:

=> include and include_once: Will only produce a warning if it fails (not visible with debugging turned off)

...instead of...

=> require and require_once: Will cause an error if it fails.

Hope that helps.

Michael Milette

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants