In this post I am going to explain how to to call template block in any CMS page or CMS static block.
If you want to call template block in CMS page or CMS static block, then you can do it by below code.
Suppose that we have a phtml file called mytemplate.phtml of module Ht_Mymodule.
1 | {{block class="Ht\Mymodule\Block\Mymodule" name="your_block_name" template="Ht_Mymodule::mytemplate.phtml"}} |
If you want to use Magento 2 default template block then you can do it as below.
1 | {{block class="Magento\Framework\View\Element\Template" name="your_block_name" template="Ht_Mymodule::mytemplate.phtml"}} |
Thats it. Enjoy Magento 2!!
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!
Leave a Reply