Drupal 7 comment.tpl.php 覆盖特定节点类型不起作用
我创建了一个 comment--track.tpl.php 文件,以便为我的“track”类型节点的注释设置主题,但我无法让 Drupal 使用它。它继续使用我的 themename/comment.tpl.php 文件。我确保清除缓存,我还设置 Devel 模块在每次加载时重建主题注册表,但它只是不想使用我的自定义主题文件。有人有什么想法吗?
I've created a comment--track.tpl.php file in order to theme the comments of my "track" type node but I can't get Drupal to use it. It keeps using my themename/comment.tpl.php file. I made sure to clear cache, I also set the Devel module to rebuilt the theme registry on each load, but it just doesn't want to use my custom theme file. Anyone has any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 Drupal 7,在主题文件夹“comment--node-[type].tpl.php”中创建一个新文件。
在您的情况下,文件名应该是“comment--node-track.tpl.php”
For Drupal 7 create a new file in your theme folder "comment--node-[type].tpl.php".
In your case file name should be "comment--node-track.tpl.php"
D7 中似乎缺少相应的模板建议。请参阅:D7 与D6。不确定为什么以及这是否是一个错误,但您可以实现 yourtheme_preprocess_comment() 并自己添加以下行。
The corresponding template suggestions seems to be missing in D7. See: D7 vs. D6. Not sure why and if that is a bug, but you can implement yourtheme_preprocess_comment() and add the following line yourself.
对于 Drupal 7:
comment--node-YOURNAMECONTENTTYPE.tpl.php
如果您想覆盖内容类型中名为
article< 的
comment.tpl.php
/代码>,您需要:
comment.tpl.php
评论--node-article.tpl.php
For Drupal 7:
comment--node-YOURNAMECONTENTTYPE.tpl.php
If you want to override your
comment.tpl.php
in content type what has namearticle
,you need to:
comment.tpl.php
from core Drupal 7comment--node-article.tpl.php