![](/img/trans.png)
[英]Magento 2 - How to call a custom phtml file in another phtml file, xml layout, static block and cms page?
[英]Magento 2 - How to call a custom phtml file in another phtml file, xml layout, static block and cms page
我的文件位于app / design / frontent / vendor_name / theme / Magento_Theme / templates / html / test.phtml
如何在另一个phtml文件,xml布局,静态块和cms页面中调用此文件
请帮忙
在xml layout
文件中
<block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"/>
在cms blocks and cms pages
{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"}}
在一个phtml
文件中
<?php include ($block->getTemplateFile('Magento_Theme::html/test.phtml')) ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.