Search code examples
magentomagento-layout-xml

Extending default layout in Magento templates


I am trying to add a page that extends my default layout. I put the content in a .phtml file, and then setup the layout like this:

<layout version="0.1.0">
    <customlanding_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <block name="content" as="content" type="core/text_list" template="quantumco/customlanding/landing_page.phtml" />
    </customlanding_index_index>
</layout>

Unfortunately, all this gives me is my layout without the content. I assume I am inserting the content block incorrectly, but I cant figure out how to get it working.


Solution

  • Reference the content block and add your own block as a child:

    <layout version="0.1.0">
        <customlanding_index_index>
            <reference name="root">
                <action method="setTemplate"><template>page/1column.phtml</template></action>
            </reference>
            <reference name="content">
                <block type="core/template" name="landing_page" template="quantumco/customlanding/landing_page.phtml" />
            </reference>
        </customlanding_index_index>
    </layout>
    

    If your block is of a specific type (which i dont think it is based on your code example provided, then replace core/template with your custom block type.