0

I have created a custom tab in Magento 2 in which the html part is shown by HTML file. Means its extension is (.html).

I want to show some blocks in that html file how would i do that.. Infact i have used php tag and echo something it doesn't work there how to show that data inside php tag?

1 Answer 1

0

PHP does not run in HTML files so you cannot directly do this.

A common but not very clean workaround is to add the HTML from the static block to window.checkoutConfig using PHP and then render that in your HTML file like so:

<div data-bind="html: window.checkoutConfig.yourCmsBlock"></div>
3

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.