Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-03-09 23:44:29
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
[plugin] [ORPHAN] ajw_comment_num
Download latest version: ajw_comment_num (v0.2)
Summary
Allows for outputting current comment number.
Requires:
- 1.0RC3 (rev180 or greater)
- If you are using Textpattern 1.0RC3 rev142 thru rev179, you will need to perform a one-line edit of
/textpattern/publish/comment.php, as outlined in this Textpattern Forum thread (allows for plugin parsing in comments)
Examples
Ideally, this is meant to be used in your default comment form. While it is possible to use this plugin with the default <ol> formatting of comments, you’ll be able to do much more fun things if you switch off numbered list formatting in admin->preferences.
<div id="comment-<txp:ajw_comment_num />">
<span class="comment-num"><txp:ajw_comment_num /></span>
...other comment form stuff...
</div>
Result:
<div id="comment-1">
<span class="comment-num">1</span>
...other comment form stuff...
</div>
Last edited by Andrew (2007-01-03 04:08:05)
Offline
Re: [plugin] [ORPHAN] ajw_comment_num
Neat.
Thanks
regards,
Agust
Offline
Re: [plugin] [ORPHAN] ajw_comment_num
This plugin is also very handy in the search_result form, thanks
Johan Nilsson
Offline
#4 2005-03-23 17:53:51
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
Re: [plugin] [ORPHAN] ajw_comment_num
Bug fix update for counting bug when using multiple tags in one comment form. Latest version is now 0.2.
Offline
#5 2005-03-24 19:00:29
- kartav
- Member
- From: Moscow, Russia
- Registered: 2005-03-07
- Posts: 18
Re: [plugin] [ORPHAN] ajw_comment_num
I get strange numbers of comments (2,4, 6, etc.).
Need help. Thanks in advance.
Last edited by kartav (2005-03-26 05:40:50)
Offline
#6 2005-03-24 19:05:02
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
Re: [plugin] [ORPHAN] ajw_comment_num
kartav, please update to version 0.2 – that is likely due to the increment bug in v0.1
Offline
#7 2005-03-24 19:06:16
- kartav
- Member
- From: Moscow, Russia
- Registered: 2005-03-07
- Posts: 18
Re: [plugin] [ORPHAN] ajw_comment_num
I have 0.2.
function ajw_comment_num($atts)
{
global $thiscomment, $ajw_commentnum, $ajw_lastcommentid;
$ajw_commentnum = (empty($ajw_commentnum)) ? 1 : $ajw_commentnum;
$ajw_lastcommentid = (empty($ajw_lastcommentid)) ? $thiscomment['discussid'] : $ajw_lastcommentid;
if ($ajw_lastcommentid!=$thiscomment['discussid'])
$ajw_commentnum++;
$ajw_lastcommentid = $thiscomment['discussid'];
return $ajw_commentnum;
}
Last edited by kartav (2005-03-24 19:41:47)
Offline
#8 2005-03-24 19:21:26
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
Re: [plugin] [ORPHAN] ajw_comment_num
hmm (no need to post the plugin code) – what is your usage?
Offline
#9 2005-03-24 19:25:33
- kartav
- Member
- From: Moscow, Russia
- Registered: 2005-03-07
- Posts: 18
Re: [plugin] [ORPHAN] ajw_comment_num
form comments
<div id="comment-<txp:ajw_comment_num />" class="<txp:ajw_comment_alt even="even" odd="odd" />">
<span class="comment-num"><txp:ajw_comment_num /></span>
<txp:message /><br />
<small>— <txp:comment_name />    <txp:comment_time />    <txp:comment_permlink>#</txp:comment_permlink></small>
</div>
Last edited by kartav (2005-03-24 19:43:20)
Offline
#10 2005-03-24 19:45:35
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
Re: [plugin] [ORPHAN] ajw_comment_num
ah crap. my bad – it has to do with the fact that I used the same global variable name in both plugins. i’ll release an update to this later today. I’ll likely have to update all three of the comment plugins. Thanks for the catch.
Offline
#11 2005-03-24 19:47:39
- kartav
- Member
- From: Moscow, Russia
- Registered: 2005-03-07
- Posts: 18
Re: [plugin] [ORPHAN] ajw_comment_num
OK
Glad to reveal small bugs.
Wait for new releases.
Offline
#12 2005-03-24 20:07:05
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
Re: [plugin] [ORPHAN] ajw_comment_num
silly really. yarrrrr. so how’s about i make this even more roundabout for ya? since it’s really a side-effect of a bug with ajw_comment_alt, I’ve updated that plugin instead. ;-)
Offline
#13 2005-03-24 20:07:42
- Andrew
- Plugin Author

- Registered: 2004-02-23
- Posts: 730
Re: [plugin] [ORPHAN] ajw_comment_num
oh, btw – now you should no longer need to specify odd=‘odd’ and even=‘even’ — it’ll use those by default (for ajw_comment_alt).
Offline
#14 2005-03-25 05:47:57
- kartav
- Member
- From: Moscow, Russia
- Registered: 2005-03-07
- Posts: 18
Re: [plugin] [ORPHAN] ajw_comment_num
Now everything works fine, thanks a lot.
Offline
Re: [plugin] [ORPHAN] ajw_comment_num
hey all, do you know if it’s possible to have this plugin reverse the counting order? For example, I have my comments displayed by POSTED DESC, therefore the newest are at the top. With this plugin however, the tag “<txp:ajw_comment_num />” always counts from 1 —> 2 —> 3… no matter how the comments are sorted. All I would want to do is reverse it so that <txp:ajw_comment_num /> displays: 9 —> 8 —> 7…
Hopefully I’m making sense here, but I will elaborate more if needed.
Thanks in advance for the help!
Offline