Sunday, September 4, 2011

Mangento: Create a New Structural Block Using Local.xml

Version: Magento 1.x

Problem:
Create a new structural block without making changes to default theme layout files e.g. page.xml.

Solution:
Add the following to local.XML to create a new structural block with name “newblock”.

<layout version="0.1.0">
    <default>
        <reference name="root">
            <block type="core/text_list" name="after_head_start"/>
        </reference>
    </default>
</layout>

Add content blocks as normal and render the structural block (as standard) in .phtml files e.g.
<?php echo $this->getChildHtml('newblock') ?>

No comments:

Post a Comment