ghostrifle
ghostrifle

Reputation: 1019

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

Upvotes: 0

Views: 2659

Answers (1)

ghostrifle
ghostrifle

Reputation: 1019

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 !

Upvotes: 1

Related Questions