8

I have done the following:

Magento 2 EE Admin > Content > Pages > Add New

Page is called Hello World

The content is:

{{block type="core/template" template="/Modules/About.phtml"}}

I have gone to and created.

App/design/frontend/Magento/Blank/Modules/About.phtml

When I visit localhost/m2/hello

The page loads expected but does not load the about.phtml which has a plain text call saying

<p>Hello this file is correct</p>
11

Try this

{{block class="Magento\Framework\View\Element\Template" name="BlockName" template="Magento_Blank::PathOftemplate/About.phtml"}}

In magento 2, Magento\Framework\View\Element\Template eq to core/template

  • This still does not work, strangely – TheBlackBenzKid Nov 8 '15 at 12:47
  • That's exactly the right way! thank you very much Amit and Marius! – Java_Waldi Dec 8 '15 at 8:01
2

in cms page i used below code its working fine

<p>{{block class="Sugarcode\Test\Block\Test" name="BlockName" template="Sugarcode_Test::test.phtml"}}</p>

Sugarcode\Test\Block\Test:- my block or else you can use "Magento\Framework\View\Element\Template"
Sugarcode_Test::test.phtml:- app\code\Sugarcode\Test\view\frontend\templates\test.phtml (template file )

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.