Module 自定义模块问题

Module 自定义模块问题,module,magento-1.7,Module,Magento 1.7,我尝试创建一个新模块。为此,我创建了indexController、config.xml、block、layout和其他必需的文件,尽管我无法查看我在块文件中编写的消息。无论何时激发url(),都应该显示输出“它来自foo-bar”,但此时它不起作用 My indexController.php code : class Foo_Bar_IndexController extends Mage_Core_Controller_Front_Action { public function

我尝试创建一个新模块。为此,我创建了indexController、config.xml、block、layout和其他必需的文件,尽管我无法查看我在块文件中编写的消息。无论何时激发url(),都应该显示输出“它来自foo-bar”,但此时它不起作用

My indexController.php code :

class Foo_Bar_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}

Code related to block :

class Foo_Bar_Block_News extends Mage_Core_Block_Template
{
    public function _prepareLayout()
    {
        return parent::_prepareLayout();
    }

    public function fetchRow()
    {               
        echo "it is from foo bar";      
    }
}

code related to config.xml :

<?xml version="1.0"?>
<config>
    <modules>
        <Foo_Bar>
            <version>1.0.0</version>
        </Foo_Bar>
    </modules>   
    <frontend>
        <routers>
            <foobar>
                <use>standard</use>
                <args>
                    <module>Foo_Bar</module>
                    <frontName>foobar</frontName>
                </args>
            </foobar>
        </routers>
        <layout>
            <updates>
                <bar>
                    <file>foobar.xml</file>
                </bar>
            </updates>
        </layout>
        <!--<events>
            <catalog_product_load_after>
                <observers>
                    <foo_bar>
                        <type>model</type>
                        <class>foo_bar/observer</class>
                        <method>catalogProductLoadAfter</method>
                    </foo_bar>
                </observers>

            </catalog_product_load_after>
        </events>-->
    </frontend>
    <global>
    <blocks>
            <foobar>
                <class>Foo_Bar_Block</class>
            </foobar>
        </blocks>            
    </global>
</config>


code related to layout.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <default>
        <reference name="content">
        </reference>
    </default>
    <foobar_index_index>
        <reference name="content">
            <block type="foobar/news"  name="news_test" template="bar/check.phtml"/>
        </reference>
    </foobar_index_index>
</layout>

Code related to template file

<?php
echo $this->fetchRow()
?>
My indexController.php代码:
类Foo_Bar_IndexController扩展了Mage_Core_Controller_Front_动作
{
公共函数索引()
{
$this->loadLayout();
$this->renderLayout();
}
}
与块相关的代码:
类Foo_Bar_Block_News扩展了Mage_Core_Block_模板
{
公共职能_prepareLayout()
{
返回父项::_prepareLayout();
}
公共函数fetchRow()
{               
回音“它来自富吧”;
}
}
与config.xml相关的代码:
1.0.0
标准
富吧
福巴
foobar.xml
富巴楼
与layout.xml相关的代码
与模板文件相关的代码

任何与此相关的帮助都将不胜感激。

在我的案例中,解决此问题的方法是禁用管理员的编译。其他一切都很好。从admin禁用编译后,将获得所需的输出

要禁用编译,请登录到magento项目的管理员端,然后转到系统>>工具>>编译,然后单击禁用按钮禁用编译