1

This may be a beginner question.

In order to get a model I use:

Mage::getModel(folder/file);

I tried the same with a block (something like getBlock) but it keeps giving me an error.

Is there any other way to access a block? Which is the correct way to do it?

Thanks.

1

Try this below code:

$this->getLayout()->getBlockSingleton('newmodule/newblock')->getYourFunction();

OR

$this->getLayout()->createBlock('newmodule/newblock')->getYourFunction();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.