Better debug informations

Everybody who work with oxid or an other aplication with big nested arrays or objects have a problem… what is the parent tree of the data you looking for.

Ok. You can use print_r, but then you got only plain text an can count white spaces to find out how deep the nest is. It`s completly confusing.

So I was looking for a better print_r and i found it here.
Just download the dBug.php and copy it into the /modules folder of your oxid installation.

Then edit the /modules/functions.php. Because the dBug.php have not a nice startup look and makes problems with smarty.


function dBug($debugVar,$blHide=true){
	include_once('dBug.php');
	ob_start();
	new dBug($debugVar,'',$blHide);
	$sOut=ob_get_contents();
	ob_end_clean();
	$sOut='<input style="z-index:9999;" type="checkbox" '.((!$blHide)?'checked="checked" ':'').'onchange="var dBugElement=document.getElementById(\''.md5($sOut).'\');if(this.checked==false){dBugElement.style.display=\'none\';}else{dBugElement.style.display=\'block\';}" /><div id="'.md5($sOut).'" style="margin-left:15px;position:absolute;display:none;z-index:99999;">'.$sOut.'</div>';
	return $sOut;
}

So, now it`s ready to use.

PHP:


dBug($variable);

Smarty (eg. details.tpl):


[{$product|@dBug}]

In both cases you’ll find a small checkbox. Just check and click. :smiley:

Coole Sache!

Lokal kommt man zwar mit einem Debugger noch besser zu recht, aber auf Online-Servern ohne Debugging-Möglichkeit wird das sicher eine wesentliche Hilfe sein.