1

I have tried many ways to call the custom phtml file in Static Block but none of them seems to work.

My file is located - app/design/frontend/Magento/MyTheme/Magento_Theme/extra/test_view.phtml

How i call the file in CMS Static Block -

{{block class="Magento\Framework\View\Element\Template" name="test_view" template="Magento_Theme::extra/test_view.phtml"}}

And when i add the static block to main content area, it just displays the code thats above. Am i doing something wrong?

asked Feb 10, 2019 at 19:49
1
  • it is because you are adding code in wysiwyg editor enable. When you add code disable editor first Commented Feb 11, 2019 at 3:20

1 Answer 1

1

Your file should replace from app/design/frontend/Magento/MyTheme/Magento_Theme/extra/test_view.phtml

to

app/design/frontend/Magento/MyTheme/Magento_Theme/templates/extra/test_view.phtml

answered Feb 10, 2019 at 20:46
15
  • still same issue, it displays code instead of content of file. Commented Feb 10, 2019 at 20:53
  • give screen what is outputed Commented Feb 10, 2019 at 20:54
  • This is my directory screen - prnt.sc/mj9wse Homepage - prnt.sc/mj9xjt Static BLock - prnt.sc/mj9ya1 Commented Feb 10, 2019 at 20:58
  • prnt.sc/mja00k - if u did mean inspect element. here u go. Commented Feb 10, 2019 at 21:03
  • @Kara How you are display your static block? Commented Feb 10, 2019 at 21:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.