loading a module's block for a custom module in magento
I'm getting really frustated about Magento's naming convention. At present, I'm trying to show some "hello world" in the admin section of my module.
The block code is located in
/var/www/magento/app/code/local/Polyvision/Tempest/Block/Adminhtml/View.php
开发者_运维百科
The code of View.php:
<?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;
}
}
?>
So, why can't I load the code via :
$x = $this->getLayout()->createBlock('tempest/adminhtml_view');
var_dump($x); // false -> did not work
I'm justing getting false as the result. I've tried numerous naming schemes and looked through other code but I cannot understand why it's not working.
Some help would be very very great !
Regards, Alex
Well ok. The above code works. My problem was a small typing error in my config.xml
So, for everyone, here's my correct global-section from my config.xml:
<global>
<helpers>
<tempest>
<class>Polyvision_Tempest_Helper</class>
</tempest>
</helpers>
<blocks>
<tempest>
<class>Polyvision_Tempest_Block</class>
</tempest>
</blocks>
</global>
Thnx for all the advices !
精彩评论