2010-12-15 41 views
1

如何在包含主頁的所有頁面中右側列中創建一個塊,而無需使用模塊名稱?Magento - 在所有頁面中創建一個固定的塊

謝謝。

+0

您可能需要使用比「模塊」等詞來形容你以後。 「模塊」在magento中有一個非常具體的含義,如果使用它,意味着人們不太可能提供幫助。 – 2010-12-15 15:33:30

+0

我是magento的初學者,在這裏使用什麼是正確的詞? – Bizboss 2010-12-15 16:48:26

+2

如果您還沒有閱讀並瞭解[塊和其他主題任務](http://www.magentocommerce.com/knowledge-base/categories/category/theming-design/)。 – clockworkgeek 2010-12-15 17:30:44

回答

5

希望能有很好理解您的問題...

1)創建模塊(例如myNameSpace對象/ Mymodule中)

2)你的模塊中創建一個塊(例如myNameSpace對象/ Mymodule中/砌塊/ Myblock)

3)創建該塊一個PHTML文件(YOURTHEMEDIR /模板/ MyModule的/ myblock.phtml)

模塊 「Mymodule中」 的,這樣它會加載一佈局4)編輯Config.xml更新文件(YOURTHEMEDIR/layout/mymodule.xml):

<frontend> 
... 
<layout> 
    <updates> 
    <mymodule> 
     <file>mymodule.xml</file> 
    </mymodule> 
    </updates> 
</layout> 
... 
</frontend> 

5)內,您的mymodule.xml把這樣的事情:

<?xml version="1.0"?> 
<frontend> 
    <layout> 
     <default> 
      <reference name="right"> <!-- this is the name of the right column block --> 
       <block type="mymodule/myblock" name="myblock" template="mymodule/myblock.phtml" /> 
      </reference> 
     </default> 
    </layout> 
</frontend> 
相關問題