Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-26 11:40:13

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

how to sort desc the comments numbers

Hi, I want to sort="posted desc" my comments’ numbers, I’m using ajw_comment_num plugin
Is there a way to do that please?
I don’t find any attributes to the plugin tag.

Thanks :)

Offline

#2 2008-04-26 12:30:46

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: how to sort desc the comments numbers

sort="discussid desc" or sort="posted desc" should both work as attributes for the <txp:comments /> tag.

Offline

#3 2008-04-26 12:43:10

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: how to sort desc the comments numbers

ruud wrote:

sort="discussid desc" or sort="posted desc" should both work as attributes for the <txp:comments /> tag.

yea sort="posted desc" works great!

but that wasn’t my question lol ;)
I want that the comments’ numbers will be sort="posted desc" too.
so I will get something like this:

#3
- name
- 26.04.08
- message

#2
- name
- 25.04.08
- message

#1
- name
- 24.04.08
- message

what I get now is:

#1
- name
- 26.04.08
- message

#2
- name
- 25.04.08
- message

#3
- name
- 24.04.08
- message

thanks :)

Last edited by THE BLUE DRAGON (2008-04-26 12:44:22)

Offline

#4 2008-04-26 13:11:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: how to sort desc the comments numbers

You can use this instead of that comment number plugin:

<txp:php>
  global $thisarticle, $my_comment_count;
  $limit = 0; # this is a configurable setting, change it to be equal to the limit attribute in <txp:comments /> (default: no limit = 0)
  if (!isset($my_comment_count)) $my_comment_count = 0;
  echo (min($limit, $thisarticle['comments_count'])) - $my_comment_count++;
</txp:php>

Last edited by ruud (2008-04-26 14:32:09)

Offline

#5 2008-04-26 13:32:47

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: how to sort desc the comments numbers

ruud wrote:

bc. <txp:php> global $thisarticle, $my_comment_count; $limit = 0; # this is a configurable setting, change it to be equal to the limit attribute in <txp:comments /> (default: no limit = 0) if (!isset($my_comment_count)) $my_comment_count = 0; echo (min($limit, $thisarticle[‘comments_count’]) – $my_comment_count++;
</txp:php>

thanks but where do I put this code please?
I tried to put in the my comments form and got the next error:
Parse error: parse error, unexpected ';' in /textpattern/publish/taghandlers.php(2804) : eval()'d code on line 5
I dont know php :/

Last edited by THE BLUE DRAGON (2008-04-26 13:35:03)

Offline

#6 2008-04-26 14:32:48

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: how to sort desc the comments numbers

See previous post for explanation and fixed code. Simply place it where you want the comment number to show up.

Offline

#7 2008-04-26 14:55:14

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: how to sort desc the comments numbers

thank you works great! :)
I had just need to change: $limit = 0; to $limit = 9999;

Offline

Board footer

Powered by FluxBB