[英]I am getting a block twice in Magento?
我正在尝试在主页上创建产品块,在那里我将page.xml复制到我的主题的布局文件夹并修改它
<page_two_columns_left translate="label">
<label>All Two-Column Layout Pages (Left Column)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
<reference name="content">
<block type="core/template" name="mycategories" output="toHtml" template="sweet/sweet.phtml"/>
</reference>
在这里,我期待在我的主页中间有一个块,我得到了但除此之外我在主页的底部还有一个块(与此块sweet.phtml相同)。页脚下方链接。 任何人都可以告诉我这是什么问题。
您已将块标记为输出块。 当视图通过控制器动作中的renderView()
呈现renderView()
,您的块既是块的子core/text_list
,它回显其子core/text_list
( 内容是core/text_list
块),也是一个将在其中呈现的输出块。自己的权利。
删除output="toHtml"
位,您将拥有所需的内容。 顺便说一下,您可以/应该将此更改从自定义page.xml移动到布局中的local.xml文件中 - 它只需要在<page_two_columns_left />
布局更新句柄中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.