if u want to display comments in views (sorting, filtering, etc) instead of default drupal way:

create a new view for comments, add contextual filter nid (provide default value: content id from url)

copy comment-wrapper.tpl.php to your custom theme folder and replace it's content with:

<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('Comments'); ?></h2>
  <?php print render($title_suffix); ?>
  <?php endif; ?>
  <div id="comment-wrapper">
    <?php
		$viewName = 'comments_for_questions'; // replace with your views name
		print views_embed_view($viewName);
	?>
  </div>
  <?php if ($content['comment_form']): ?>
  <h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
  <?php print render($content['comment_form']); ?>
  <?php endif; ?>
</div>

voila! now u have ajax comments working with views!

Comments

acouch’s picture

Status: Active » Closed (duplicate)