Last active
May 27, 2019 12:31
-
-
Save oliverde8/f121ea479bb3efa8683783c357c2bdfc to your computer and use it in GitHub Desktop.
Magento 1 - Add comment blocks to html output to debug layout & blocks.
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 | |
/** | |
* Modify | |
* File : app/code/core/Mage/Core/Block/Template.php | |
* Method: fetchView | |
* At the very begining. | |
* | |
*/ | |
$startTime = microtime(true); | |
/** | |
* Modify | |
* File : app/code/core/Mage/Core/Block/Template.php | |
* Method: fetchView | |
* At the end replace the return. | |
* | |
*/ | |
$block = get_class($this); | |
$tags = implode(',', $this->getCacheTags()); | |
$key = $this->getCacheKey(); | |
$time = date(DATE_ISO8601); | |
$genTime = microtime(true) - $startTime; | |
$debug = "<!-- "; | |
$debug .= "\n\t- Block: $block"; | |
$debug .= "\n\t- name: {$this->getNameInLayout()}"; | |
$debug .= "\n\t- template: $includeFilePath"; | |
$debug .= "\n\t- date: $time"; | |
$debug .= "\n\t- cache-key: $key"; | |
$debug .= "\n\t- cache-lifetime: " . $this->getCacheLifetime(); | |
$debug .= "\n\t- cache-tags: $tags"; | |
$debug .= "\n\t- cache-ttl: {$this->getCacheLifetime()}"; | |
$debug .= "\n\t- gen-time: $genTime"; | |
$debug .= "-->"; | |
return $debug . $html; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment