I want to make a cms static block which should display/render the content of a .phtml file (echo "Test1"). Content of my cms static block:

<div id="something">
     {{block class="Magento\Catalog\Block\Product\View\Description" name="test" template="product/view/test1.phtml" }}

something like that. Would this work out ?

Location of "test1.phtml" is in vendor\magento\module-catalog\view\frontend\templates\product\view\test1.phtml

Also: what if I change location of "test1.phtml", how can I write it in {{ ... }} ?

2 Answers 2


You can use Magento\Framework\View\Element\Template basic template.

Try this:

<div id="something">
    {{block class="Magento\Framework\View\Element\Template" name="test" template="path/to/my/file.phtml" }}

This should work.


If you need to display product information you have to use blocks from prduct view. Example:

<div id="something">
    {{block class="Magento\Catalog\Block\Product\View\Description" name="test" template="path/to/my/file.phtml" }}

PHTML file position depends on your architecture. If you are not embedding this in a module you could put it in your template.


<div id="something">
    {{block class="Magento\Catalog\Block\Product\View\Description" name="test" template="Magento_Theme::mytemplate.phtml" }}

And put your file under: design/frontend/yourtheme/default/Magento_Theme/mytemplate.phtml

  • Thanks again ! I'm using class="Magento\Catalog\Block\Product\View\Description" because I need to display product-sku attribute. One question: template="var/test1.phtml" would also work, if that would be it's location ? Dec 24, 2016 at 17:13
  • See my updated post Dec 24, 2016 at 17:23

Use class "Magento\Framework\View\Element\Template" and you can also pass any value if required:

{{block class="Magento\Framework\View\Element\Template" name="test_file" testId="66" template="Magento_Catalog::product/widget/test.phtml"}} 

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.