In phtml file I use

<img src='<?php echo $this->getViewFileUrl('images/logo.png'); ?>'

How to do same in html file ?


you might have got your answer as it is an old post but I came across this today. PHP may not directly be written in .html files. If you want to then you might want to see this discussion.

Magento does not consider it good practice at first. So, only way I can think of using that particular function for your html template is through the use of Javascript.

You can extend magento's core requireJS modules that defines this function then change any attribute of your DOM through JS.

| improve this answer | |
  • But thanks, may come handy to someone else – Zinat Dec 12 '17 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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