0

Having a issue with figuring out how to get this working.

file path for custom template:

app/design/frontend/VENDOR/THEME/custom/custom.phtml

In my CMS page, I have it written as:

{{block class="Magento\Framework\View\Element\Template" template="VENDOR_THEME::custom/custom.phtml"}}

What am I doing wrong here? Please help

1

You need to define your phtml file with block in layout.xml file and then call it same way.

Like below example of layout.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="test" template="Vendor_Test::test.phtml"></block>
        </referenceContainer>
    </body>
</page>

Then in your cms page :

{{block class="Magento\Framework\View\Element\Template" template="Vendor_Test::test.phtml"}}
  • Thank you for your help so far, but now im getting this error message : We're sorry, an error has occurred while generating this email. – Jru-Ski Jun 28 '17 at 21:49
  • @Jru-Ski well thats your custom theme override issue , thats not related to call phtml file in block .check the email template or something which you have overriden – Manthan Dave Jun 29 '17 at 4:34

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.