As M1 if I need to display just some phtml in another block or page, so we have to create it in a current theme then we can retreive it via xml or the other block
xml:
<the_layout_handle>
<reference name="root">
<block type="core/template" name="block1" template="path/to/file.phtml">
</reference>
</the_layout_handle>
then in the other file we get it like this: <?php echo $this->getBlockHtml('block1'); ?>
phtml:
or directly like this: <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('path/to/file.phtml')->toHtml(); ?>
Question :
Directly in file I know that bu how to reproduce the same thing via xml in M2 ?
phtml:
echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magento_Luma::path/to/file.phtml")->toHtml();
Issue:
I have some phtml in app/design/frontend/Magento/Luma/template/block1.phtml
i want to display it in home page, so in content I have this: {{block class="Magento\Framework\View\Element\Template" name="block1" template="Magento_Luma::template\block1.phtml"}}
but it doesn't work !