WordPress.org

Ready to get started?Download WordPress

Forums

The Process of Debugging? (3 posts)

  1. dffmonolith
    Member
    Posted 7 years ago #

    I've been using the Qwilm theme, modified quite a bit in appearance. I announced my site, and the first time someone posted a comment, it caused a problem with displaying that page and its comment -- it just shows a very short white box. It also suppressed the sidebar, which is inserted in the code after the comments section. You can see this in action at http://www.mendocinofun.com/museums, and pretty much any other page shows what it should be like.

    I don't expect specific help with this problem, but it tells me I better learn quickly how to debug. There's no outward indication of an error -- is there a log somewhere? Is there a way to see where the PHP code is breaking? Is there a debugger or anything like that? Or a way to trap errors like TRY/RECOVER or its equivalent so that it continues without dropping the rest of the page?

    Is there a guide on debugging? I've programmed a lot, but not too much in PHP. Everything has just worked so nicely since I've been using WordPress, at least until I went live -- and I have my first couple of paying ads in the sidebar. Ouch!

    In case anyone is familiar with Qwilm, I didn't change anything around where the comments are inserted, or anything in comments.php except the email address.

    Thanks for any help at learning how to debug in this environment....

    Regards,
    Dennis

  2. aaronfay
    Member
    Posted 7 years ago #

    Hi Dennis,

    I would recommend a tool like Firebug (plugin for FireFox) that will help you inspect your markup on the browser-side.

    I'm not sure how comfortable you are in php, but you could try my debug plugin to look at elements on the php side of things without breaking your live site.

    Hope that helps,
    Aaron

  3. 2stepsback
    Member
    Posted 6 years ago #

    For older versions, where Aaron's plugin may not work or somehow you can't set it up, this basic thing is always there - logging to a file -

    function log_msg( $s = "" ){
    	fileputcontents("qry.log", date("d-m-Y h:i:s a :=").$s."\n");
    }
    function fileputcontents($path,$string){
    	$error = false;
    	if(!($fp = fopen($path,'a'))){
    		$error = true;
    	}
    	if (fwrite($fp, $string) === FALSE) {
    		$error = true;
        }
        fclose($fp);
        if($error){
        	return false;
        }else{
        	return true;
        }
    }

    note: the function name "fileputcontents" is just indicative that it is doing the same thing as the PHP 5 function file_put_contents(,,,FILE_APPEND);

    It is very basic, so it is use-ful as well as feature-less.

Topic Closed

This topic has been closed to new replies.

About this Topic