Go
Decent Blogging using Foswiki Read on
20 Sep 2005 - 17:24 in tagged , by Michael Daum
Being so happy about having found a pure TWikiML solution (albeit by the help of the SpreadSheetPlugin) to count BlogComments (see Counting BlogComments (Redux) (20 Sep 2005)) I abandoned this approach for (a) a more generic solution to count any TopicTypes, not only BlogComments, and (b) implemented it in the BlogPlugin using a new tag.
COUNTTOPICS boils down to a SEARCH with the parameters in place to do so. A format string lets you specify how to present the result and - if there's no hit - optionally depress any output at all. So if there are no comments to an entry then there's no point in displaying a zero in the header wink . The same tag is used to seed the number attribute of the comment form when posting a comment. Bottomline,
  1. we solved a more general problem without much extra effort
  2. the BlogPlugin was cleaned up internaly to probide a query interface
  3. the plugin solution is more flexible
  4. and faster
  5. we removed the SpreadSheetPlugin dependency (so far)
  6. but fattened up the "special purpose" plugin - the BlogPlugin which only exist to implement this blog application


3 Comments

1 MichaelDaum replied -1 minutes

So generic

Actually, the COUNTTOPICS solution is so general that it isn't blogs related any more. Well, it'll rest inside the BlogPlugin for now. … reply

2 MichaelDaum replied 3 days, 2 hours later

Features: Counts in latest comments and commenting comments

Hey, now the latest comments get counts aswell. And we've got BlogComments on BlogComments now, albeit they aren't rendered recursively yet. Coming soon. … reply

3 MichaelDaum replied 4 days, 23 hours later

Counting comments recursively

As we want to implement a threaded comment system comments can be nested arbitrarily. So counting all comments of a BlogEntry becomes a recursive matter. But COUNTTOPICS is a rather plain/generic procedure that simply counts topics of a given type. Well, so we derived a COUNTCOMMENTS tag that takes a referee and recursively counts all comments that are involved from there on. See TestBlogEntry0. … reply

Leave a Reply

You may have to login or register to comment if you haven't already.
r7 - 27 Feb 2006 - 16:43:53 - Main.MichaelDaum
Copyright © 1999-2012 Michael Daum Consulting. All rights reserved. Impressum.