$e= & $modx->Event; switch ($e->name) { case "OnWebPagePrerender": $text = $modx->documentOutput; // search and replace empty tags in document $modx->documentOutput = str_replace('].]',']]',$modx->documentOutput); break; return; // stop here - this is very important. break; }