【发布时间】:2015-12-30 09:39:15
【问题描述】:
试图将 custom.phtml 文件包含在标题中。搜索了很多指令,但没有看到像getChildHtml这样的指令
对于 .xml 我找到了
<block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/header/custom.phtml"/>
对于我找到的 .phtml
<?php include ($block->getTemplateFile('Magento_Theme::html/header/custom.phtml')) ?>
这意味着,对于添加 .phtml 文件,我们可以使用 .xml 或 .phtml,但不像我们习惯的那样:将模板添加到 .xml,然后从 .phtml (getChildHtml) 调用此文件
【问题讨论】:
标签: magento magento2 magento-2.0