![](/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.