3

If you look at https://github.com/magento/magento2/tree/2.3-develop/app/code/Magento/Theme/view/frontend/templates , there's phtml templates in this folder, but also in a subfolder called /html

Looking at the code style, there doesn't appear to be any noticeable differences between the phtml files in templates and the ones in templates/html.

What's the point of this folder? When developing a theme, should we be using our own html subfolder and if so, what is supposed to go in it (other than overriding / extending the default Magento 2 phtml files for replacement)?

2 Answers 2

2

As far as I know there is no special meaning or functionality for the html folder, it seems to be templates that are global and by that I mean they load on pretty much every page. For example:

  • Header
  • Breadcrumbs
  • Container
  • Footer
  • Messages

So for your own modules/themes it is completely up to you whether you follow the same naming convention or not (unless you are overwriting one of these templates in which case you need to use the same path). Personally I would opt for a name along the lines of global or components rather than html as it means nothing - every PHTML template contains html.

They are not only used for unit tests.

0

The folder structure of a theme does not need a html folder inside a template

The html folder inside the template contains files related to unit test.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.