0
我對Magento的命名約定感到非常沮喪。目前,我試圖在模塊的管理部分顯示一些「hello world」。爲magento中的自定義模塊加載模塊塊
塊代碼位於
/var/www/magento/app/code/local/Polyvision/Tempest/Block/Adminhtml/View.php
View.php的代碼:
$x = $this->getLayout()->createBlock('tempest/adminhtml_view');
var_dump($x); // false -> did not work
:
<?php
class Polyvision_Tempest_Block_Adminhtml_View extends Mage_Core_Block_Template
{
public function __construct()
{
parent::__construct();
}
protected function _toHtml()
{
$html="hello world";
return $html;
}
}
?>
那麼,我爲什麼不能通過加載代碼結果我只是變得虛假。我嘗試了很多命名方案並查看了其他代碼,但我無法理解它爲什麼不起作用。
有些幫助會非常棒!
Regards,Alex
你有沒有嘗試echo而不是返回$ html? – Nasaralla
是的,我做到了。我還在構造函數中添加了一個die(),以查看它是否被加載,但沒有運氣。 – ghostrifle
您是否在模塊的config.xml中定義了塊? – Simon