gpt4 book ai didi

php - 如何在自定义 Shopware 主题中包含自定义插件的模板?

转载 作者:行者123 更新时间:2023-12-03 09:12:24 25 4
gpt4 key购买 nike

我正在尝试将来自自定义插件的模板包含在 Shopware 5.2 的自定义主题中。

主题模板包含以下行:

{include file="frontend/custom/colorpicker.tpl"}

插件模板位于/custom/plugins/PLUGINNAME/Resources/views/frontend/custom/colorpicker.tpl

我收到以下错误消息:

Fatal error: Uncaught SmartyException: Unable to load template snippet 'frontend/custom/colorpicker.tpl' in 'frontend/detail/index.tpl|frontend/plugins/seo/index.tpl' in...

我已经尝试将父级添加到文件路径,但没有任何乐趣。错误消息消失,但模板未加载:

{include file="parent:frontend/custom/colorpicker.tpl"}

不幸的是,我在 Shopware 文档中找不到任何内容,说明是否需要任何特殊内容才能包含插件中的模板。

最佳答案

尝试在主题 Theme.php 中添加类变量 protected $injectBeforePlugins = true;

https://developers.shopware.com/designers-guide/smarty/#inheritance-and-plugin-templates

关于php - 如何在自定义 Shopware 主题中包含自定义插件的模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40994211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com