[英]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.