我想在Magento 2中将多个文件包含在一个phtml文件中。该项目最初在laravel中,看起来像这样:
https://i.imgur.com/XpUbynf.png
所以现在我需要将所有项目导入到Magento 2项目中,但是语义有所不同。到目前为止,我已经尝试过了,但是没有用:
https://i.imgur.com/hewweJg.png
我要调用的文件位于子文件夹中,这些文件的路径为:
Wo / EyeTest / view / frontend / templates / eyetestSteps
与其他子文件夹一样
Wo / EyeTest / view / frontend / templates / eyetestSteps / step1 /
Wo / EyeTest / view / frontend / templates / eyetestSteps / step2 /
你知道我该怎么做吗?当文件位于同一目录中时,没有问题,它可以显示,我想我写的路径不好。
谢谢
请使用以下路径:
<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Wo_EyeTest::eyetestSteps/step1/_instructions.phtml")->toHtml(); ?>
谢谢 !就像魅力一样,完美无缺:)