PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 23, 2022

[FIXED] How to include multiple html file in another phtml file?

 August 23, 2022     include, magento, magento2, php     No comments   

Issue

I would like to include several file in Magento 2 in one phtml file. The project was in laravel at first and looks like this :

https://i.imgur.com/XpUbynf.png

So now I need to import all the project in a Magento 2 project but the semantic is different. I have tried this so far but doesnt work :

https://i.imgur.com/hewweJg.png

The files I'm trying to call are in a subfolder and the path of these files is :

Wo/EyeTest/view/frontend/templates/eyetestSteps

with other subfolders like

Wo/EyeTest/view/frontend/templates/eyetestSteps/step1/

Wo/EyeTest/view/frontend/templates/eyetestSteps/step2/

Do you have any idea how can I do this ? When the file is in the same directory, there is no problem, it's display, and I guess I'm writting the path badly.

Thanks


Solution

Please use the below path for this:

<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Wo_EyeTest::eyetestSteps/step1/_instructions.phtml")->toHtml(); ?>


Answered By - Amit Saini
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing