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"

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

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?