Created
January 11, 2014 01:25
-
-
Save pasamio/8365784 to your computer and use it in GitHub Desktop.
Snippet to output usable debugging to an external file in situations where the template may not play nice with debug or when the debug output may be a couple of MB larger. Also useful for comparing various page loads, AJAX requests and a few other things.
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 | |
$header[] = '<html>'; | |
$header[] = '<head>'; | |
$header[] = '<script src="https://code.jquery.com/jquery.js"></script>'; | |
$header[] = '<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>'; | |
$header[] = '<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">'; | |
$header[] = '</head>'; | |
$header[] = '<body style="background-color: lightgrey">'; | |
$footer[] = '</body>'; | |
$footer[] = '</html>'; | |
$filename = '/tmp/joomla_debug_' . microtime(1) . '.html'; | |
file_put_contents($filename, implode('', array_merge($header, $html, $footer))); | |
$html[] = '<p>Wrote out ' . $filename . '</p>'; | |
echo str_replace('</body>', implode('', $html) . '</body>', $contents); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment