Sometimes when we’re developing specific functionality for a Magento website, we’ll need to shift around, modify, add, or remove blocks within the layout. Sometimes this is a skinning issue and can be achieved by moving around the calls to echo $this->getChildHtml(), other times it may require an override within our custom theme’s local.xml file. However, what if we wanted to change the layout or change blocks dependant on some custom factors? There are some built-in methods in Magento which I’ll mention now, however it’s worth looking a little more in-depth and getting our hands dirty.
Page-Specific Handles
Handles are used in Magento as the “parent nodes” in the layout XML for defining which layout we’re using. Example: catalog_product_view is the handle for the product view page in Magento, and cms_index_index is used for the homepage. These handles can extend beyond the basic front_name / controller_name / action_name in that we can target specific categories, products and stores. In certain controllers (category controllers, product controllers) they directly use the addHandle(‘handle_name’) function on an update object. You should be able to get the current update object in any controller, helper, or block if you’ve extended classes correctly via $this->getLayout()->getUpdate(). Below are some layout handles which can be used to target specific cases within your Magento site:


