We are running into an issue where we need to run a little php script within a .html file in Magento 2, namely;
When we have tried adding the ability for html files to run php via the .htaccess, it ends up causing other errors within Magento so it just ends up breaking more things. Namely, using things like;
AddType application/x-httpd-php56 .php .htm .html or AddType application/x-httpd-php .html .htm
Are there other alternatives to try to run php within this html file, or is it possible to change this file to .phtml like so many of the others? I would just have to find where it is originally called I assume and change that from .html to .phtml?
Thanks for the insight!
The html files would not allow you to run php code inside it, but .phtml does,
a .phtml file can run either php code or html code or both together.
It will surely work with .phtml what you are trying.
Hope it helps !
I agree! That would work perfectly, however the file as is, is .html and I am not sure where it is loaded to where I can change that loading section to .phtml, thus being able to change the actual file to .phtml.
Is there a way to see where the actual file is loaded from?
Yes, Definitely there is way to find, you can use Template Path Hints it will show you the template from the content is loading, but it has limitations for the some pages for
EX : Checkout page
Follow the docs how to enable it (please ensure that your mode is developer and you add URL of ?templatehints=VALUE to see path hints)
NOTE : if you find that files are loading from core module, don't change in that particular file, extend it in your theme
Hope it helps !