我陷入了一个非常简单的任务,我制作了一个自定义模块,并希望添加一个前端页面。
我为前端创建了一个块,并在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 / Module / Block / Index.php代码中阻止
类Ns_Module_Block_Index扩展Mage_Core_Block_Template {}
它是非常基本的,但不知道我缺少的地方,我的模块/ index.phtml中的文字没有显示在前端。
答案 0 :(得分:0)
您需要在config.xml中定义模块'module'的块:
<config>
<global>
<blocks>
<module>Ns_Module_Block</module>
</blocks>
</global>
</config>
答案 1 :(得分: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>
希望这对您有所帮助。如果我能帮助你,请告诉我。
答案 2 :(得分:0)
好的我发现错误!,在layout module.xml中,块类型应该是“module / index”