4

How to call block without controller in phtml file for my custom module in magento2??

2 Answers 2

5

You can do this:

$blockObj= $block->getLayout()->createBlock('Magento\Catalog\Block\Product\View');

I'm not really sure if this is what you are after, your question is a little on the short side.

3

You can do this:

$blockObj= $this->getLayout()->createBlock('Magento\Catalog\Block\Product\View');
1
  • use $this instant of $block Aug 20, 2016 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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