Hello Friends,
In this atrtical we learn how to call .phtml file from cms page, layout file and another .phtml file.

From CMS Page

{{block class=”Magento\Bannerslider\Block\Slideshow” template=”Magento_Bannerslider::bannerslider.phtml”}}

From another .xml file

<block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"/>

From another .phtml

<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magento_Theme::html/test.phtml")->toHtml();?>



Leave a Reply

Your email address will not be published. Required fields are marked *