Call our sales line
08000 484 679
Home > Magento Tips > Checking which layout handles can be used on a Magento page

Checking which layout handles can be used on a Magento page

Posted on: 29th Jan 2013 By: Robert Kent No Comments

When diving into the depths of layout XML its always beneficial to know which layout handles can be used in any given locations on your Magento website.

Here is a nice little piece of code that you can use to display exactly which handles are being used on any given page:


<?php print_r($this->getLayout()->getUpdate()->getHandles());  ?>

What you can do is stick this little beauty inside your header.phtml to display the active layout handles for your page.

Screen Shot 2013-01-29 at 11.19.46

You can then use these layout handles in your xml files – like so:


<customer_logged_out>

// some stuff here

</customer_logged_out>

If you can combine this technique with the custom magento layout handles post form a while back – you’ll be laughing when it comes to controlling your Magento website through layout xml.

By Robert Kent

Rob is Ecommerce Web Design’s lead PHP developer, and an expert at customising the Magento framework to create completely unique sites. Follow him on twitter (because he's a twit) http://twitter.com/kent_robert. - .

Post A Comment

Your comments:
Enclose code snippets within the appropriate tags: [php][/php]   [js][/js]   [xml][/xml]   [css][/css]   [html][/html]
E.g: [php]<?php echo "hello world"; ?>[/php]

Search Blog

Follow us on Twitter

Archives

For the record...

Views & opinions in this blog are those of the individual and do not necessarily reflect those of E-commerce Web Design or the Creare Group.