[英]magento block doesnt work
我的indexController.php
class Pfay_Test_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction () {
echo "hello world from indexController.php";
$this->loadLayout();
$this->renderLayout();
}
我的xml
<?xml version="1.0" ?>
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<routeurfrontend_index_index>
<reference name="content">
ITS WORK! <block type="core/template" template="test/afficher.phtml" />
ITS DOESNT WORK! <block type="test/monblock" name="afficher_monbloc" template="test/afficher.phtml" />
</reference>
</routeurfrontend_index_index>
<h1>Template afficher.phtml</h1>
<?php
echo "hello world from afficher php";
?>
当我使用字符串
<block type="core/template" template="test/afficher.phtml" />
所有工作正常,我看到“来自indexController.php的hello”,页眉,页脚等,在页面中心,我看到“模板afficher.phtml”和“来自afficher php的hello世界”。
但是当我尝试使用块时,我只会看到“来自indexController.php的问候”。
Monblock.php
<?php
class Pfay_Test_Block_Monblock extends Mage_Core_Block_Template
{
public function methodblock()
{
return ‘informations about my block !!’ ;
}
}
有人帮忙吗?
我使用这个网站http://www.pierrefay.com/magento-create-block-44 ,在这个网站上他使用了错误
“关于我的封锁的信息!” ; 我替换为“有关我的封锁的信息!” ;
现在,它的工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.