Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7 Drupal主题修改_Drupal 7_Drupal Theming - Fatal编程技术网

Drupal 7 Drupal主题修改

Drupal 7 Drupal主题修改,drupal-7,drupal-theming,Drupal 7,Drupal Theming,我试图对巴蒂克主题做一个简单的修改。我只想在用户评论中禁用永久链接 我将/themes/bartik/templates/comment.tpl.php复制到/sites/all/themes 并将/sites/all/themes/comment.tpl.php修改如下: <p class="comment-permalink"> <?php // print $permalink; ?> <!-- comment out permalink -->

我试图对巴蒂克主题做一个简单的修改。我只想在用户评论中禁用永久链接

  • 我将
    /themes/bartik/templates/comment.tpl.php
    复制到
    /sites/all/themes
  • 并将
    /sites/all/themes/comment.tpl.php
    修改如下:

    <p class="comment-permalink">
      <?php // print $permalink; ?>  <!-- comment out permalink -->
    </p>
    

  • 我清除了所有缓存,但永久链接仍然显示

如果我对源文件(
/themes/bartik/templates/comment.tpl.php
)进行上面的修改,它会工作。。。但我知道你不应该修改源文件。这就是为什么我把它移到
/sites/all/themes

我做错了什么

我将
/themes/bartik/templates/comment.tpl.php
复制到
/sites/all/themes

并修改了
/sites/all/themes/comment.tpl.php

这肯定行不通。新文件的内容根本不会被呈现,Drupal甚至不会关心这个文件,因为您没有使用Drupal期望的主题格式

修改原始主题不是一个好的做法,这是正确的。如果您想对原始主题稍作修改,则必须创建一个子主题,该子主题继承父主题的资源

  • drupal.org上有一个关于创建子主题(基本主题是Bartik)理论的好教程:
  • 您可以在此处阅读主题的.info文件:
  • 下面是关于创建D7子主题的简短总结:
启用新子主题后,您可以将Bartik的
comment.tpl.php
复制到新子主题的
templates
目录中,清除缓存,并享受基于Bartik修改自己主题文件的乐趣,而无需担心原始文件


顺便说一句,我建议您使用Drupal回答。

谢谢。我成功地创建了次主题。谢谢你对drupal.stack的介绍