Develo Design


Layout handles in magento design

I recently helped debug an issue in Magento where a block wasn’t being added for the Index action of a custom controller. As our usual weapon of choice Alan Storms commerce bug wasn’t installed finding out why the block wasn’t being added to the layout was a little difficult. To solve this I had a look a the layout object from the controller

This returned the layout model object (Mage_Core_Model_Layout), this layout model is useful if your looking to create instances of blocks

or modify loaded blocks

The main method of interest is

which returns an instance of the loaded layout update model (Mage_Core_Model_Layout_Update), This model stores all loaded handles used for the current layout, so by using

we can fetch all layout handles. This returned the following layout handles.

Comparing the above handles to the xml used I can see they were trying to load designtool_index and not designtool_index_index. Problem solved and on to the next one.

So to find out the layout handles used add the following code to the controller after a call to load the layout.


Loading Disqus Comments ...
Loading Facebook Comments ...

Post Comment

Your email address will not be published. Required fields are marked *

Discuss My Project

We want to hear about your project! Provide us with a few details and we’ll get back to you for a chat.