2014-03-05 98 views
0

我被困在非常簡單的任務中,我做了一個自定義模塊並希望添加一個前端頁面。Magento前端塊

我爲前端做了一個塊,並在module.xml文件中使用了html作爲控制器索引函數。

下面是module.xml

<?xml version="1.0"?> 
<config> 
    <modules> 
    <Coeus_Recurring> 
     <version>0.1.0</version> 
    </Coeus_Recurring> 
    </modules> 
    <frontend> 
    <routers> 
     <recurring> 
     <use>standard</use> 
      <args> 
      <module>Coeus_Recurring</module> 
      <frontName>recurring</frontName> 
      </args> 
     </recurring> 
    </routers> 
     <layout> 
      <updates> 
      <recurring> 
       <file>recurring.xml</file> 
      </recurring> 
      </updates> 
     </layout> 
    </frontend> 
    <global> 
    <helpers> 
     <recurring> 
     <class>Coeus_Recurring_Helper</class> 
     </recurring> 
    </helpers> 
    <blocks> 
     <recurring> 
     <class>Coeus_Recurring_Block</class> 
     </recurring> 
    </blocks> 
    <models> 
     <recurring> 
     <class>Coeus_Recurring_Model</class> 
     <resourceModel>recurring_mysql4</resourceModel> 
     </recurring> 
     <recurring_mysql4> 
     <class>Coeus_Recurring_Model_Mysql4</class> 
     <entities>   
       <recurring> 
       <table>recurring_order</table> 
       </recurring> 
     </entities> 
     </recurring_mysql4> 
    </models> 
     <events> 
      <sales_order_place_after> <!-- identifier of the event we want to catch --> 
       <observers> 
        <sales_order_place_after_handler> <!-- identifier of the event handler --> 
         <type>model</type> <!-- class method call type; valid are model, object and singleton --> 
         <class>recurring/observer</class> <!-- observers class alias --> 
         <method>saverecurring</method> <!-- observer's method to be called --> 
         <args></args> <!-- additional arguments passed to observer --> 
        </sales_order_place_after_handler> 
       </observers> 
      </sales_order_place_after> 
     </events> 
    <resources> 
     <recurring_setup> 
     <setup> 
      <module>Coeus_Recurring</module> 
     </setup> 
     <connection> 
      <use>core_setup</use> 
     </connection> 
     </recurring_setup> 
     <recurring_write> 
     <connection> 
      <use>core_write</use> 
     </connection> 
     </recurring_write> 
     <recurring_read> 
     <connection> 
      <use>core_read</use> 
     </connection> 
     </recurring_read> 
    </resources> 
    </global> 
</config> 

和最後一個,塊在端代碼/本地/ NS /模塊/塊/ index.php的代碼

類Ns_Module_Block_Index延伸Mage_Core_Block_Template {}

它是非常基本的,但不知道我缺乏和我的文字在module/index.phtml沒有顯示在前端。

+0

我都試過,但沒有成功:( –

回答

0

您需要定義內部config.xml中的模塊「模塊」塊:

<config> 
<global> 
    <blocks> 
    <module>Ns_Module_Block</module> 
    </blocks> 
</global> 
</config> 
+0

它已經在那兒了,我沒有張貼完整config.xml。請看現在,我已更新問題。 –

0

只是改變你的config.xml按下面您的自定義

<?xml version="1.0"?> 
<config> 
<frontend> 
    <routers> 
     <module> 
     <use>standard</use> 
      <args> 
      <module>Ns_Module</module> 
      <frontName>module</frontName> 
      </args> 
     </module> 
    </routers> 
     <layout> 
      <updates> 
      <module> 
       <file>module.xml</file> 
      </module> 
      </updates> 
     </layout> 
    </frontend> 
<global> 
    <blocks> 
     <module> 
      <class>Coeus_Recurring_Block</class> 
     </module> 
    </blocks> 
</global> 
</config> 

希望調用塊這一定會幫助你。讓我知道我是否可以進一步幫助你。

+0

我有相同的結構,請參閱我的config.xml。 –

0

好,我發現在佈局module.xml錯誤!,塊型應該是「模塊/指數」