dongtan6336 2017-02-08 09:04
浏览 91
已采纳

如何使用comment-wrapper- <content-type> .tpl.php更改drupal 7中子主题中特定节点类型的注释头

Hi I am new to Drupal Development. I am trying to alter comment section of article content. My requirement is I want to change the header in [Comment Section] 1 from Add New Comments to to add new review and comments to previous reviews ,and subject to review subject in my subtheme which uses bartik as base theme.

Can anyone help me. Here is the code which I altered in comment-wrapper-article.tpl.php in sub theme.But I can't alter the display.

<?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; ?>
?>
  • 写回答

1条回答 默认 最新

  • duankuixi1930 2017-02-13 05:01
    关注

    Finally I had Succeed in getting the solution to the problem, in case if any one faces the same problem.Here is the solution.

    <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>
    

    the main requirement is the file name should be in the following format."comment-wrapper--node-contenttype.tpl.php"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码