Posted By

zoranmk on 11/26/11


php xml layout magento

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


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

 / Published in: PHP

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

  1. //Full path to the log file:
  2. $logPath = Mage::getConfig()->getOptions()->getVarDir().DS.$file_name.time().'.xml';
  4. //Layout model: Mage_Core_Model_Layout
  5. $layout = Mage::getSingleton('core/layout');
  7. //Generate our xml with Mage_Core_Layout_Update model and save it in a file
  8. $xml = '<'.'?xml version="1.0"?'.'>';
  9. $xml .= '<layout>'.trim($layout->getUpdate()->asString()).'</layout>';
  10. file_put_contents($logPath, $xml);

Report this snippet  

You need to login to post a comment.