There are two types of blocks in magento – one can render automatically and other don’t. If you want to render layout block automatically in Magento you could do following.
- Use core/text type. These blocks will render itself automatically. However, this method is not suitable when your block use its own class.
- Any block of type core/text_list will automatically render all its children. Just make your block is a child of core/text_list
<catalog_product_view> <reference name="content"> <block type="extension/block" template="extension/block.phtml"/> </reference> </catalog_product_view>
There are a number of predefined core/text_list blocks in magento layout. Those are:
- after_body_start
- topMenu
- left
- content
- right
- before_body_end
You can use them or create your own blocks for the same purpose.
Learning how render layout block automatically in Magento will allow you to keep your code clean. If you are looking for more information about magento layout blocks try to check Alan Storm’s No Frills Magento Layout.