Skip to content

Instantly share code, notes, and snippets.

@jonleverrier
Last active December 12, 2018 17:16
Show Gist options
  • Save jonleverrier/878887b7ae3f31de0b0ca3890a16bf0f to your computer and use it in GitHub Desktop.
Save jonleverrier/878887b7ae3f31de0b0ca3890a16bf0f to your computer and use it in GitHub Desktop.
Log the output of a placeholder or snippet to the MODX error log. Useful for checking what a placeholder actually outputs...
<?php
/*
logOutput snippet for MODX
Use like this:
[[!logOutput? &input=`[[+placeholder]]`]] or
*/
if (empty($input)) {
$modx->log(1, "The output was empty",'','[logOutput]');
} else {
$modx->log(1, "Output: " . $input,'','[logOutput]');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment