Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
Re: How do I limit the list of article comments?
Great! Will you include a sort attribute too?
Offline
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
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
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