Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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
如何使用注释包装器更改Drupal7子主题中特定节点类型的注释头-<;内容类型>;。tpl.php_Php_Drupal_Drupal 7_Drupal Theming - Fatal编程技术网

如何使用注释包装器更改Drupal7子主题中特定节点类型的注释头-<;内容类型>;。tpl.php

如何使用注释包装器更改Drupal7子主题中特定节点类型的注释头-<;内容类型>;。tpl.php,php,drupal,drupal-7,drupal-theming,Php,Drupal,Drupal 7,Drupal Theming,嗨,我是Drupal开发的新手。 我试图改变文章内容的评论部分。 我的要求是我想将[Comment Section]中的标题从添加新评论更改为添加新评论,并将评论更改为以前的评论,以及将bartik作为基本主题的子主题中的主题更改为评论主题 有人能帮我吗。 下面是我在子主题的comment-wrapper-article.tpl.php中修改的代码。但是我不能修改显示 <?php <div id="comments" class="<?php print $classes; ?

嗨,我是Drupal开发的新手。 我试图改变文章内容的评论部分。 我的要求是我想将[Comment Section]中的标题从添加新评论更改为添加新评论,并将评论更改为以前的评论,以及将bartik作为基本主题的子主题中的主题更改为评论主题

有人能帮我吗。 下面是我在子主题的comment-wrapper-article.tpl.php中修改的代码。但是我不能修改显示

<?php
<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if ($node->type == 'article'): && $node->type == 'article');?>
<?php print render($title_prefix); ?>
<h2 class="title"><?php print t('previous Reviews'); ?></h2>
<?php print render($title_suffix); ?>
<?php endif; ?>
<?php print render($content['comments']  ?>
<?php if ($content['comment_form']): ?>
<h2 class="title comment-form"><?php print t('Add New Review'); ?></h2>
<?php print render($content['comment_form']); ?>
<?php endif; ?>
?>
>
?>

最后,我成功地找到了问题的解决方案,以防任何人面临同样的问题。以下是解决方案

<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if ($content['comments'] && $node->type != 'forum'): ?>
<?php print render($title_prefix); ?>
<h2 class="title"><?php print t('Previous Reviews'); ?></h2>
<?php print render($title_suffix); ?>
<?php endif; ?>
<?php print render($content['comments']); ?>
<?php if ($content['comment_form']): ?>
<h2 class="title comment-form"><?php print t('Add New Review'); ?></h2>
<?php print render($content['comment_form']); ?>
<?php endif; ?>
</div>

一个小建议:不要打开/关闭那么多php标记,而是打开一次,将所有输出存储在一个变量中,然后回显一次。通过这样做,您也会发现代码中存在的问题。@DainisAbols感谢您的提示,但即使是核心模板代码,也有类似的多个php标记,我是否遗漏了一些关于它们的信息。