我已经创建了一个Prestashop子主题,我购买了一个主题。我可以看到我的子主题(一旦启用),但每次我访问主题页面切换主题时,我都会收到一个500错误。
我解决这个问题的方法是修改我的子主题的config/heme.yml文件。这就是我通常会得到的500错误:
parent: parent-theme
name: My Child Theme
display_name: Child Theme
version: 1.0.0
author:
name: "Me"
email: "email@email.com"
url: "domain.com"
assets:
use_parent_assets: true
css:
all:
- id: theme-custom
path: assets/css/custom.css
media: all
priority: 1000
js:
all:
- id: theme-custom
path: assets/js/custom.js
priority: 1000
position: bottom这是我需要在confog/heme.yml文件中包含的内容,这样才不会得到500错误:
parent: parent-theme
name: My Child Theme
display_name: Child Theme
version: 1.0.0
author:
name: "Me"
email: "email@email.com"
url: "domain.com"
assets:
use_parent_assets: true以css:开头的代码行是什么导致了这个问题?– id:是否需要引用它上面的内容,或者必须是theme-custom
你们有没有什么好的教程/参考资料可以给我指点,以正确的方式创建一个儿童主题?
我的Prestashop版本是1.7.3
谢谢。
发布于 2018-10-25 06:56:41
你可以阅读完整的指南如何实现这一点:https://devdocs.prestashop.com/1.7/themes/reference/template-inheritance/parent-child-feature/
但是您需要在theme.yml文件中使用的代码才能使用您的自定义样式/脚本文件,这里是一个完整的示例。
parent: classic
name: childtheme
display_name: My first child Theme
version: 1.0.0
assets:
use_parent_assets: true
css:
all:
- id: custom-lib-style
path: assets/css/custom-lib.css
js:
all:
- id: custom-lib-script
path: assets/js/custom-lib.js警局。保持正确的列表是很重要的,否则无法工作。
https://stackoverflow.com/questions/52972638
复制相似问题