如何在另一个 phtml 文件中包含多个 html 文件?
How to include multiple html file in another phtml file?
我想在一个 phtml 文件中包含 Magento 2 中的多个文件。
该项目最初在 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(); ?>
我想在一个 phtml 文件中包含 Magento 2 中的多个文件。 该项目最初在 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(); ?>