Created
July 23, 2013 10:32
-
-
Save pepebe/6061442 to your computer and use it in GitHub Desktop.
Write formit values into a debug chunk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
Assuming the chunk named debug
exists, I think you should just call the debug hook as usual:
[[!FormIt? &hooks=`debug2chunk`]]
This hook should write values into that chunk once the form is processed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use this?