Magento – Where is content of getChildHtml(‘left’) ?>

layoutmagento-1.9template

I have a question about the file 2-columns-left.phtml of my blog of my theme Legenda. I want edit the title of my block-blog-categories but without success.

I see that the content of block is in the

<div class="col-left sidebar col-sm-4 <?php if(Mage::app()->getFrontController()->getRequest()->getModuleName() != 'blog'):  ?>col-md-3<?php endif; ?>">
    <?php echo $this->getChildHtml('left') ?>
</div>

Now, where is the file that is recalled from getChildHtml('left')? How should I do for edit the title of "Blog Categories"?

Best Answer

The block left is a very generic block in Magento.

It is defined in the file app/design/frontend/base/default/layout/page.xml and is simply a block of type core/text_list.

<block type="core/text_list" name="left" as="left" translate="label">
    <label>Left Column</label>
</block>

The basic idea is that you can simply use this block and fill it with the content you need.

You can simply reference it and add items. A perfect example of this is the customer navigation in file app/design/frontend/base/default/layout/customer.xml.

<reference name="left">
    <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
        <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
        <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
        <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
    </block>
    <block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml">
        <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
    </block>
    <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
    <remove name="tags_popular"/>

</reference>

Here Magento simply adds in child blocks into the left block. You can see exactly where content is added by searching for the following in the layout files:

<reference name="left">

You can also see when the left column is removed by search for the following in layout files:

<remove name="left"/>

For more information on this block I would recommend reading the Structural block blog post from Inchoo

Related Topic