2012-09-06 60 views
0

我正在爲前端創建一個新的Magento 1.7.0.2模塊,但我無法讓我的一個塊附加到頁面的任何體面點。目前它隱藏在頁面的底部,所有默認的東西都在它的上面。我還沒有真正搞亂前端,但是,這是一個相當新鮮的Magento安裝。我試過了引用標籤,但是如果我現在包含它們,則無論我在名稱引號中輸入什麼內容,我的塊都會完全消失。Magento塊不能使用Refrence

我的佈局:

我現在的模板:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title>Test Block</title> 
</head> 
<body> 
    <h2>Hello!</h2> 
    <div class="Test1"> 
     <?php echo $this->displaystyles();?> 
    </div> 
    <br /><hr /><br /> 
    <div class="test2"> 
     <?php echo $this->displaypapers();?> 
    </div> 

</body> 
</html> 

我想獲得該塊到頁面的中間。任何幫助將不勝感激,因爲我顯然缺少重要的東西。

回答

0

在你的佈局xml中有幾個錯誤,但不是糾正它們,我會以這種方式作爲開始(除非你有理由在你自己的模板中重新創建整個頁面佈局??)

佈局:

<?xml version="1.0"?> 

<layout version="0.1.0"> 
    <makeorder_index_index> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="content"> 
      <block type="makeorder/testblock" name="orderdispaly" template="makeorder/orderdisplay.phtml" /> 
     </reference> 
    </makeorder_index_index> 
</layout> 

模板:

<h2>Hello!</h2> 
<div class="Test1"> 
    <?php echo $this->displaystyles();?> 
</div> 
<br /><hr /><br /> 
<div class="test2"> 
    <?php echo $this->displaypapers();?> 
</div> 
+0

太好了!好的,在開發過程中,我得到了引用和句柄切換。謝謝。 –

+0

任何人都知道爲什麼這個塊在頁面底部重複? –

+0

您是使用我的代碼還是您提供的樣本? –