NP_CommentCounter

This plugin returns the sequence number of this comment with the current item.

General Plugin info
Author: Appie Verschoor (xiffy)
Current Version: 1.0
Download: Download 1.0 as zipfile
Code: code (1.1)
Demo: -
Forum Thread: -

description

This is a tiny little plugin that gives you the sequence number of the current comment coupled o the item. So you can display
comment 1:
comment 2:
etc.

When a new item is available the counter starts at 1 again. You can use this only in the CommentsTemplate !!

Code

<?php
 
/*
	Version history:
	- 1.1 (2007-10-30): fixed to remove PHP error. Work in Nucleus 3.31
	- 1.0 (2003-12-01): initial version
*/
 
class NP_CommentCounter extends NucleusPlugin {
 
	function getName()    {	return 'CommentCounter'; }
	function getAuthor()  { return 'Appie Verschoor (xiffy)'; }
	function getURL()     {	return 'http://wakka.xiffy.nl/CommentCounter'; }
	function getVersion() {	return '1.0'; }
	function getDescription() { 
		return 'This plugin returns the sequence number of this comment with the current item.';
	}
 
	function getEventList() { 
		return array('PreComment','PreItem'); 
	}	
 
	function event_PreComment($data) {
        $this->commentSeq = $this->commentSeq + 1;
	}
 
	function event_PreItem($data) {
/*	    $this->curItem = $data['item']['itemid']; */
	    $this->commentSeq = 0;
	}
 
        function doTemplateCommentsVar(&$item, &$comments) {
             echo $this->commentSeq;
        }
}
 
?>

Plugin review

NP_CommentCounter version 1.1 works with Nucleus CMS version 3.31 - 2007-10-27 ftruscot

Back the plugins overview

commentcounter.txt · Last modified: 2007/10/31 04:36 (external edit)
 
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