Magento 创建新块并将其添加到样板

Magento 创建新块并将其添加到样板,magento,magento-1.8,Magento,Magento 1.8,我是一个Magento初学者,需要帮助创建一个新的自定义块。 基本上,我只想在它被调用时显示hello 模块安装xml文件,app/etc/modules/MyExtensions_HelloBlock.xml 结果: 致命错误:在中的布尔值上调用成员函数setTemplate /app/design/frontend/venedor/default/template/page/1column.phtml 在线58 我正在跟踪此操作。块文件夹丢失 块的路径应该是app/code/local/My

我是一个Magento初学者,需要帮助创建一个新的自定义块。 基本上,我只想在它被调用时显示hello

模块安装xml文件,app/etc/modules/MyExtensions_HelloBlock.xml

结果:

致命错误:在中的布尔值上调用成员函数setTemplate /app/design/frontend/venedor/default/template/page/1column.phtml 在线58

我正在跟踪此操作。

块文件夹丢失


块的路径应该是app/code/local/MyExtensions/HelloBlock/block/Hello.php

Dude,块文件应该在块目录app/code/local/MyExtensions/HelloBlock/block/Hello.php中
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <MyExtensions_HelloBlock>
            <active>true</active>
            <codePool>local</codePool>
        </MyExtensions_HelloBlock>
    </modules>
</config>
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <MyExtensions_HelloBlock>
            <version>0.0.1</version>
        </MyExtensions_HelloBlock>
    </modules>
    <global>
        <blocks>
            <helloblock>
                <class>MyExtensions_HelloBlock_Block</class>
            </helloblock>
        </blocks> 
    </global>
</config>
<?php
class MyExtensions_HelloBlock_Block_Hello extends Mage_Core_Block_Template 
{    
    public function hello()
    {
        echo "hello";
    }
}
?>
<?php
    $this->hello();
?>
echo $this->getLayout()->createBlock('helloblock/hello')->setTemplate('helloblock/hello.phtml')->toHtml();