扩展Magento模板中的默认布局

时间:2012-07-31 18:45:57

标签: magento magento-layout-xml

我正在尝试添加扩展我的默认布局的页面。我将内容放在.phtml文件中,然后设置如下布局:

<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>

不幸的是,所有这些都让我觉得我的布局没有内容。我假设我正在错误地插入内容块,但我无法弄清楚如何使其工作。

1 个答案:

答案 0 :(得分:1)

引用内容块并将您自己的块添加为子项:

<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>

如果您的块属于特定类型(我认为它不是基于您提供的代码示例,请将core/template替换为您的自定义块类型。