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?
1 Answer 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
-
still same issue, it displays code instead of content of file.Kara– Kara2019年02月10日 20:53:47 +00:00Commented Feb 10, 2019 at 20:53
-
give screen what is outputedPetro Chaikivskyi– Petro Chaikivskyi2019年02月10日 20:54:16 +00:00Commented Feb 10, 2019 at 20:54
-
This is my directory screen - prnt.sc/mj9wse Homepage - prnt.sc/mj9xjt Static BLock - prnt.sc/mj9ya1Kara– Kara2019年02月10日 20:58:59 +00:00Commented Feb 10, 2019 at 20:58
-
prnt.sc/mja00k - if u did mean inspect element. here u go.Kara– Kara2019年02月10日 21:03:14 +00:00Commented Feb 10, 2019 at 21:03
-
@Kara How you are display your static block?Petro Chaikivskyi– Petro Chaikivskyi2019年02月10日 21:03:28 +00:00Commented Feb 10, 2019 at 21:03
wysiwyg editorenable. When you add code disable editor first