首页 文章

需要在Magento2中覆盖自定义模块phtml文件和magento主题模板文件

提问于
浏览
0

我在Magento2中使用默认的magento luma主题 .

我想更改此文件,并需要覆盖app / code文件夹

/vendor/magento/module-theme/view/frontend/templates/html/header.phtml文件 .

我还想更改现有的自定义模块模板文件以覆盖 .

应用程序/代码/公司/模块名/视图/前端/模板/ view.phtml

我尝试了很多方法,但没有工作 .

请建议 .

Regrads Vimal

2 回答

  • 0

    请按照以下说明操作:

    1. 您想要覆盖任何供应商/扩展/模块.PHTML文件 . 您需要创建自己的主题 . 之后,您将覆盖.PHTML文件 .

    2 . >>点击此处了解如何创建主题https://www.cloudways.com/blog/create-custom-theme-magento-2-part-1/

    3 . >> app / design / frontend / Custom Package Name / Custom Theme Name / Magento_Theme / templates / html / header.phtml

  • 0

    请按照以下说明操作:

    • 您想要覆盖任何供应商/扩展/模块.PHTML文件 . 您需要创建自己的主题 . 之后,您将覆盖.PHTML文件 .

    • 点击此处了解如何创建主题http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

    • For Override Core Phtml文件(Exp: - 如果你想要module_theme的header.phtml文件(module_theme被Magento_Theme取代)app / design / frontend / Namespacename_Theme / Custom_Theme_Name / Magento_Theme / templates / html / header.phtml)

    • For Override自定义Phtml文件app / design / frontend / Namespacename_Theme / Custom_Theme_Name / Custom module namespace_Modulename / templates / custom.phtml)

相关问题