PHP Magento Tips

Use of local.xml in Magento

Rate this posting:
{[['']]}

local.xml is very useful and important file in Magento. you can define all your layout updates and layout changes in this file. Below some are tips which is very helpful to work with local.xml.

First change your Home page layout to 3 Column from admin and Enable Mage_Poll From System >> Configuration >> Advance Settings tab.

 Here we will remove Magento Poll from right side and insert it into left side. Also we will remove Catalog Category left layered Navigation Block from Category Page.

In app/design/frontend/vijay/default/layout/local.xml add below code:

<layout version="0.1.0" encoding="UTF-8"><!-- everything goes in here -->
 <!-- this container tells you what your default layout is. like 'header' and 'footer' -->
    <!-- code goes here -->
<default>
    
    <reference name="right">
        <action method="unsetChild"><name>right.poll</name></action>
    </reference>
    
    <reference name="left">
        <action method="insert"><name>right.poll</name></action>
        <!--<action method="unsetChild"><child>category_filter</child></action>-->
    </reference>
    
    
</default>

<catalog_category_layered>
    <reference name="left">
    <remove name="catalog.leftnav" />
        <block type="catalog/navigation" name="catalog.leftnav.categories" after="currency" template="catalog/navigation/left.phtml"/>
    </reference>
</catalog_category_layered>
</layout> 

By Calling unsetChild method we can not unset the block instance it only remove the referance of the block from list of children blocks within the parents. while with remove block action method we can not add it further.
Tag : Magento
0 Comments On "Use of local.xml in Magento"

Back To Top