Return to Snippet

Revision: 53540
at November 26, 2011 07:09 by zoranmk


Initial Code
//Full path to the log file:
$logPath = Mage::getConfig()->getOptions()->getVarDir().DS.$file_name.time().'.xml';

//Layout model: Mage_Core_Model_Layout
$layout = Mage::getSingleton('core/layout');

//Generate our xml with Mage_Core_Layout_Update model and save it in a file
$xml = '<'.'?xml version="1.0"?'.'>';
$xml .= '<layout>'.trim($layout->getUpdate()->asString()).'</layout>';
file_put_contents($logPath, $xml);

Initial URL


Initial Description
Snippet for logging down all of the layout updates loaded on each request in Magento.

Initial Title
How to log all xml layout updates in Magento on each request

Initial Tags
php, xml, layout, magento

Initial Language
PHP