Debug Your Layout

Categories: Magento - Tags:

So, you’ve created your module, added layout files and templates, but they are not showing up on front? You can see what’s going on with your layouts using Mage::log() method in your controller. The code below would log loaded layout handles and compiled layout update string into var/log/layout.log file. Don’t forget to enable debug mode in your index.php, see how to do it.

public function testAction()
{
$this->loadLayout();
// …

//Somewhere within controller action after loadLayout() was called
//The code below logs loaded layout handles to “var/log/layout.log” file
Mage::log(
$this->getLayout()->getUpdate()->getHandles(),
null,
‘layout.log’
);
//The code below logs merged layout to “var/log/layout.log” file
Mage::log(
$this->getLayout()->getUpdate()->asString(),
null,
‘layout.log’
);
}

denys
Profile - Website

Comments

No comments yet.

Write a comment

You must be logged in to write a comment.

« »