I override content.html using /app/design/frontend/Altius2/Jasani/Magento_Checkout/web/template/minicart/content.html

When I change stuff in this it changes but I can't use PHP because it's an HTML file. So I created a custom phtml and added the code below.

1.Created PHTML


<?= /* @escapeNotVerified */ __('My html is loaded') ?>
<h3>successfully !</h3>

2.instantiate our custom phtml:

<?php $myphtml = $block->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magento_Checkout::my-custom.phtml")->toHtml(); ?>

<script type="text/javascript">
    var my_phtml = <?php echo json_encode($myphtml); ?>;

3.Added to html


<div id="my-dialog-id" title="Information" data-bind="html:my_phtml" />

I see the changes only in that cart.phtml 's controller but not in all pages.

I need to completely override the content.html with php code. Thanks in advanced.

Your Answer

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

Browse other questions tagged or ask your own question.