NP_ShowComments

This plugin lets a user determine how many comments to show, what order to show them, and whether or not results should be paged. Replaces the <%comments(templatename)%> skinvar in Item Pages skin part.

General Plugin info
Author: Frank Truscott
Current Version: 1.30
Download: 1.30 zip 4kb 1 file
Code:
Forum Thread: Forum

Installing

  1. Unzip the file and upload the contents to your plugin directory
  2. Install the plugin…
  3. Replace <%comments(templatename)%> skinvar in the Item pages part of your skin with <%ShowComments(…)%> as described below.

Usage and Skin Vars

Only works on Item Pages. Replaces <%comments(templatename)%> skinvar.

<%ShowComments(templatename, NumToShow, SortOrder, Page)%>

where

  • templatename is the name of template to use to display comments
  • NumToShow is an integer indicating how many comments to show (per page if page=yes). Use -1 to indicate that all comments should be shown (or leave paramter blank).
  • SortOrder is the order to display comments - asc, desc, or random. Default is asc and shows first comment at top, desc shows the most recent comments first, random shows comments in random order and disables any paging
  • Page indicates whether results should be shown paged with NumToShow per page. yes or no. default is no. If NumToShow is -1 and page is yes, 20 comments will be shown per page .

It is only valid in the Item Pages part of a skin, so go to the Skins admin area and find yoru skin's Item Pages part. Where you see the <%comments(templatename)%> skin var, add <%ShowComments(…)%> like this:

Using the default skin as an example, where you find

<%comments(default/item)%>

you can put

<%ShowComments(default/item)%>

to do the exact same as the comments skin var

Or you can put

<%ShowComments(default/item,10,desc)%>

to show only the 10 most recent comments.

Or your can put

<%ShowComments(default/item,20,asc,yes)%>[/code] to show comments in the normal order, but only display 20 at a time.

Or you can put

<%ShowComments(default/item,5,random)%>

to show 5 random comments.

Tips and Tricks

As of version 1.11, the plugin will read a parameter of scbegin=last in the URL string as a request to view the page containing the latest comment. This can be used to make it compatible with NP_LatestComments with the following modifications to NP_LatestComments.php (example from LatestComments v 1.83)

Lines 247-250 look like this:

$out .= str_replace("%u", $displayedName, $com_templ);
$out = str_replace("%l", $IndexURL.$itemlink."#".$row->cnumber, $out);
$out = str_replace("%P", $IndexURL.$itemlink, $out);
$out = str_replace("%c", $ctext, $out);

After these lines add this line:

$out = str_replace("%n", $row->cnumber, $out);

Now in the plugin options change the comments formatting option to this:

<li><a href="%P&scbegin=last#%n" title="Posts to: %p">%u</a> says %c</li>

Wishlist

Bugs

History

  • Version 1.1, released 11-04-2006
  • Version 1.11, release 09-07-2007
    • if scbegin=last in the url request will cause the page containing the latest comment to be displayed. This should help this plugin play well with NP_LatestComments if LatestComments template set to include scbegin=last in the link to the comment.
  • Version 1.20, released 08 Aug 2009
    • allow use in templates
  • Version 1.30, released 08 Mar 2012
    • fix incidental bug, but will be critical when Nucleus CMS 4.0 is released

Plugin review

NP_ShowComments version 1.30 works with Nucleus CMS version 3.64. - 2012-03-08 ftruscot

showcomments.txt · Last modified: 2012/03/08 17:50 by ftruscot
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki