Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solution: News Manager & External Commenting Working Together
#1
In reading through the forums, it seems some of the information out there on this topic is a bit out of date so I thought I'd add my piece.

Currently, it is suggested (via combining the information on the External Commenting install page and the support thread) that the following be appended to the /inc/site.php file (at the end of the nm_show_post function) in the News Manager plugin to get things working:

Code:
get_external_comments($id, $url, $title);

However, this results in comments to one post appearing on all the posts. Instead, append this:

Code:
get_external_comments($slug, $url, $title);

Context:
Code:
<div class="nm_post">
      <h3 class="nm_post_title">
        <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
      </h3>
      <p class="nm_post_date"><?php echo i18n_r('news_manager/PUBLISHED') . " $date"; ?></p>
      <div class="nm_post_content"><?php echo $content; ?></div>
      <?php
      # print tags, if any
      if (!empty($post->tags)) {
        echo '<p class="nm_post_meta"><b>' . i18n_r('news_manager/TAGS') . ':</b>';
        $tags = explode(',', $post->tags);
        foreach ($tags as $tag) {
          $url = nm_get_url('tag') . $tag;
          echo " <a href=\"$url\">$tag</a>";
        }
        echo '</p>';
        }
        # added to display a comment box via the External Comments Plugin
        get_external_comments($slug, $url, $title);
        # show "go back" link, if required
      if (strstr($_SERVER['QUERY_STRING'], "post=$slug")) {
        echo '<p class="nm_post_back"><a href="javascript:history.back()">&lt;&lt; ';
        i18n('news_manager/GO_BACK');
        echo '</a></p>';
      }
      ?>

For sites where multiple post excerpts are featured on the news page, getting external commenting working introduces the problem of scads of conflicting comment boxes loading up on a single page. To clean up the mess and have the comment boxes appear only on discrete post pages instead of beneath excerpts, it is necessary to prevent the external comments from loading when the excerpts are generated. To do so, ignore what I've written above and instead append the following to the /inc/site.php file of the News Manager plugin:

Code:
<?php if ($excerpt==false) echo get_external_comments($slug, $url, $title); ?>

Context:
Code:
# show "go back" link, if required
if (strstr($_SERVER['QUERY_STRING'], "post=$slug")) {
        echo '<p class="nm_post_back"><a href="javascript:history.back()">&lt;&lt; ';
        i18n('news_manager/GO_BACK');
        echo '</a></p>';
      }
      ?>
<?php
if ($excerpt==false) echo get_external_comments($slug, $url, $title); ?>
    </div>
    <?php
  } else {
    echo '<p>' . i18n_r('news_manager/NOT_EXIST') . '</p>';
  }

}
Reply


Messages In This Thread
Solution: News Manager & External Commenting Working Together - by jsmcgraw - 2012-02-19, 16:58:11



Users browsing this thread: 1 Guest(s)