Magento – How to discover the XML Layout name for a page

layoutmagento-1.9xml

How do I discover the XML Layout name for a page?

Eg. <catalog_category_default> is the name for a default (non-layered) category page, <cms_index_index> is the name of a CMS Page.

I have several modules that are creating pages, and I would like to know what the XML Layout name for these pages are, or indeed, any page.

I was hoping that enabling Add Block Names to Hints under Developer > Debug in the System Configuration area would give me these page names, but they only seem to give me the name of the blocks used within that page.

Can anyone help?

Best Answer

To get current layout handle, use :

Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles()); exit;
//OR    
var_dump(Mage::app()->getLayout()->getUpdate()->getHandles());exit;

In controller action, use can use it like :

public function indexAction()
{
        $this->loadLayout();
        $this->renderLayout();
        Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
}
Related Topic