Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-30 09:20:02

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

How do I limit the list of article comments?

I’ve managed to display a list of articles, each with its on little list of comments below them. But now that little list is getting huge.. Is there a way to limit that? I’ve tried <txp:comments form="article-comments" wraptag="ol" break="li" limit="3" /> but that limit attribute doesn’t seem to work.. (I’m using 4.0.5 btw)

TIA

/Anton

Last edited by Anton (2007-08-30 09:20:29)

Offline

#2 2007-08-30 09:55:16

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

Re: How do I limit the list of article comments?

There is no limit attribute for the comments tag. You’d have to use a plugin to do that (I happen to be writing one that has such functionality, but it’s not finished yet).

Offline

#3 2007-08-31 08:03:40

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: How do I limit the list of article comments?

ruud wrote:

There is no limit attribute for the comments tag. You’d have to use a plugin to do that (I happen to be writing one that has such functionality, but it’s not finished yet).

YES!

Cheers, Ruud.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#4 2007-08-31 15:34:15

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: How do I limit the list of article comments?

Great! Will you include a sort attribute too?

Offline

#5 2007-08-31 15:49:59

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

Re: How do I limit the list of article comments?

a ‘sort’ attribute is already available in TXP 4.0.5 (just not documented yet in textbook)

Offline

#6 2007-08-31 15:58:53

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: How do I limit the list of article comments?

oh, cool! :) thanx

ps. for those who can’t wait for ruud’s plugin, comes a little jQuery snippet that hides all but the 3 last comments in a list (from the DOM that is):

<script type="text/javascript" src="/textpattern/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".article-comments .comments").each(function(){
$(this).children().slice(3).hide();
});
});
</script>

(your HTML can be different of course..)

Last edited by Anton (2007-08-31 16:05:04)

Offline

#7 2007-08-31 20:57:52

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I limit the list of article comments?

ruud wrote:

a ‘sort’ attribute is already available in TXP 4.0.5 (just not documented yet in textbook)

Really? Do you mean that we can use <txp:comments sort="desc" />???

Offline

#8 2007-08-31 23:23:07

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

Re: How do I limit the list of article comments?

Almost. You’d have to use something like sort="posted desc" (column name + direction)
All tags that produce lists should have a sort attribute now (including section_list and category_list).

Last edited by ruud (2007-08-31 23:23:48)

Offline

#9 2007-09-01 16:11:14

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I limit the list of article comments?

Great! Now I can get rid of my home made mini-plugin to sort them descending :)

Offline

Board footer

Powered by FluxBB