pepebe
7/23/2013 - 10:32 AM

Write formit values into a debug chunk

Write formit values into a debug chunk

<?php
/* 
 * Write formit values into a debug chunk 
 * basic idea by bruno17
 * Be careful with the append parameter. If your script continues to
 * write into the debug chunk, You'll get a GIGANTIC file that 
 * can cause a wsod (white screen of death) without any hint to the real cause...
*/
$append = false;

$values = $hook->getValues();
$debug['values'] = $values;

$output .= print_r($debug,1);


if ($chunk = $modx->getObject('modChunk',array('name'=>'debug'))){
  if($append === true){
    	$chunk->setContent($chunk->getContent().$output);
	}
	else {
    	$chunk->setContent($output);
	}
    $chunk->save();
}
return true;