Magento – Adding a custom block to the cms home page

blockscmsmagento-1.7template

I want to modify the layout in page.xml in layout folder for the cms home page.

This is the original xml code,

<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>

This code seems to pull whatever you type in the cms home page via the admin area.

So I want to add a custom block inside that block, such as,

<block type="core/text_list" name="content" as="content" translate="label">
 <label>Main Content Area</label>
 <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
</block>

And it works. But what about adding a custom block that I want to create under app/design/frontend/MY_LOCAL/template/cms/default/home.phtml ?

<block type="core/text_list" name="content" as="content" translate="label">
 <label>Main Content Area</label>
 <block type="page/html_content" name="content" template="cms/default/home.phtml"/>
</block>

Nothing come out. Magento is not pulling that block of template file at all.

Any ideas?

Best Answer

I think there are two issues here. For one, the type or class on your block might be wrong and second, the name should be unique.

<block type="core/text_list" name="content" as="content" translate="label">
 <label>Main Content Area</label>
 <block type="core/template" name="some_random_name" template="cms/default/home.phtml"/>
</block>