我在Magento两次拦截?

Sco*_*ion 7 magento magento-1.4 magento-1.5

我正在尝试在主页上创建产品块,在那里我将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>
Run Code Online (Sandbox Code Playgroud)

在这里,我期待在我的主页中间有一个块,我得到了,但除此之外,我在主页的底部还有一个块(与此块sweet.phtml相同)..页脚下方链接.任何人都可以告诉我这是什么问题.

ben*_*rks 12

您已将块标记为输出块.当视图renderView()在控制器动作中呈现时,您的块既是块的子节点,它回显其子节点(内容core/text_list块),也是一个将自己呈现的输出块.

取下output="toHtml"钻头,你就会得到你需要的东西.顺便说一下,您可以/应该将此更改从自定义page.xml移动到布局中的local.xml文件中 - 它只需要在<page_two_columns_left />布局更新句柄中.