![](/img/trans.png)
[英]Magento 2 - How to call a custom phtml file in another phtml file, xml layout, static block and cms page?
[英]how to call a PHTML file within a CMS page Magento
我需要在我的 cms 頁面中調用一個 phtml 文件,但它不起作用。
這是cms頁面中的代碼
{{block type="core/template" template="catalog/product/form-top.phtml"}}
fom-top.phtml 基本上會打開一個表單,但這並不重要。 此代碼不會顯示超出標題的任何內容。
關於如何在 CMS 頁面中調用 phtml 文件的任何想法?
查看您網頁的源代碼並滾動到底部以查看 php 錯誤。
form-top.phtml 被調用,但里面有一個 php 錯誤,它失敗了。 錯誤可能發生在一個不可見的 div 中,這就是為什么您看不到它的正常方式。
用以下代碼替換您的行
{{block class="Magento\Framework\View\Element\Template" template="catalog/product/form-top.phtml"}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.