[英]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.