Thursday, June 23, 2011

Template Hints for the Magento Admin

Simply paste the following into
app/code/core/Mage/Adminhtml/Block/Template.php
public function fetchView($fileName)
{
Varien_Profiler::start($fileName);
extract ($this->_viewVars);
$do = $this->getDirectOutput();
if (!$do) {
ob_start();
}
echo '<div style="position:relative;
border:1px dotted red; margin:6px 2px; 

padding:18px 2px 2px 2px; zoom:1;">

<div style="position:absolute; left:0; top:0; padding:2px 5px; 
background:red; color:white; font:normal 11px Arial; text-align:left !important; 
z-index:998;" onmouseover="this.style.zIndex=\'999\'" onmouseout="this.style.zIndex=\'998\'"
title="'.$fileName.'">'.$fileName.'</div>';
$thisClass = get_class($this);
echo '<div style="position:absolute; 
right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial; 
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex=\'999\'"
onmouseout="this.style.zIndex=\'998\'" title="'.$thisClass.'">'.$thisClass.'</div>';
try {
include $this->_viewDir . DS . $fileName;
} catch (Exception $e) {
ob_get_clean();
throw $e;
}
echo '</div>';
if (!$do) {
$html = ob_get_clean();
} else {
$html = '';
}
Varien_Profiler::stop($fileName);
return $html;
}
before the last closing brace }.
Just be sure to remove the code again then you are finished. If there is enough demand for it I might package the change up into a new MageBase extension.