custom file path
app/code/Magento/Theme/view/frontend/templates/html/test.phtml
calling in xml layout file
<block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"/>
calling in blocks and cms pages
{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"}}
calling in any phtml file
<?php include ($block->getTemplateFile('Magento_Theme::html/test.phtml')) ?>
or as before
<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magento_Theme::html/test.phtml")->toHtml();?>
app/code/Magento/Theme/view/frontend/templates/html/test.phtml
calling in xml layout file
<block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"/>
calling in blocks and cms pages
{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"}}
calling in any phtml file
<?php include ($block->getTemplateFile('Magento_Theme::html/test.phtml')) ?>
or as before
<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magento_Theme::html/test.phtml")->toHtml();?>
Hi My file is in app/design/frontent/vendor_name/theme/Magento_Theme/templates/html/test.phtml
ReplyDeleteHow to call this files in another phtml file, xml layout, static block and cms page
Calling in blocks and cms pages - method doesn't working... It generates 500 internal server error. (using 2.0.5 version). do you have any idea?
ReplyDeletehow can i call custom block in magetno 2 cms ?
ReplyDeletefor "Call Phtml file on CMS Page" Magento 2 check this
Deletehttp://www.onlinecode.org/call-phtml-file-cms-page-magento2/
for "Call Phtml file on CMS Page" Magento 2 check this
ReplyDeletehttp://www.onlinecode.org/call-phtml-file-cms-page-magento2/