JosephLenton / PHP-Error

Better error reporting for PHP, and prettier too!
1.35k stars 151 forks source link

Include in other project, return in html area #20

Open bueltge opened 12 years ago

bueltge commented 12 years ago

Thanks for your nice project. I would like to include this in my small debugging plugin for WordPress, its easier to use without coding and also on client sites. But i inlcude all returns in an html area, for use in tabs and view only, wat is important.

But i dont find not an hint in your documentatino, how it is possible to include this without an direkt echo at start. maybe you can help me?

If you see on my project, than you find an small example on the inc/about.phphow works my retur of input and you can also see this on the scrrenshoot inside the repo. https://github.com/bueltge/Debug-Objects

Thanks!

JosephLenton commented 12 years ago

Hey,

Thanks for your nice project.

Thanks, I'm glad you like it.

I don't quite follow your request; I can see multiple ways to interpret what you are asking, so I'd like to ask if you could explain a little further what it is you are trying to achieve.

When an error has occurred, do you want to control where the output is shown, within the page? Currently it just replaces the page with the error HTML, is this what you want to change?

Or is the problem to do with integrating PHP Error into your plugin?

bueltge commented 12 years ago

Thanks for the reply and yes, I like the plugin. I will control the output; I will it embeded in an html-markup, not as overlay about the screen. Important for us devs in WordPress it is, that we can use your nice lib not as replace of the html, but as output inside from markup to see the markup of WP and the error-notices.

JosephLenton commented 12 years ago

Ok, I'm starting to understand what you want to do with this.

However after you after just the error messages, without any HTML formatting, or do you want them with the HTML formatting? i.e. so you can place the HTML output within your own container?

bueltge commented 12 years ago

Great and thanks for understand my cruesome English. You can get the message with html, but not replace the current html from screen. I will include the message and html inside a div. May different parts on the plugin was viewable with tabs. Each tab have different content.

JosephLenton commented 12 years ago

Ok, at the weekend when I get time, I'll add in a callback which can be called instead of the current display logic. This will just pass in the HTML. Something like:

    reportError( array(
        'on_display' => function( $html ) {
            // handle you display here
        }
    ) );

Does that sound ok?

I'll also offer other parameters for the rest of the error/exception information, just in case you need it. For example

    reportError( array(
        'on_display' => function( $html, $ex, $message, $file, $line, $stack ) {
            // handle you display here
        }
    ) );

However note that when an exception is hit, the page will stop anyway. That isn't me, that's PHP, because the exception is not handled by the user code.

bueltge commented 12 years ago

great and many thanks for your reply and todo!

bueltge commented 11 years ago

Hi Joseph, current do you have no dev version for this implementation, or? Thanks for your time.