reading the number of comments for an entry by post number

Discussion corner for Developers of Serendipity.
Post Reply
jerwarren

reading the number of comments for an entry by post number

Post by jerwarren »

I'm sorry to ask what is probably a really rudimentary question, but I've been searching and digging through code for a while unable to answer my question myself.

How does one go about reading the number of comments on an entry? The code I've managed to find walks through all the entries and reads the number of comments for each one, but what I am trying to do is fetch the number of comments if you only know the post number. I've been unable to find the correct usage for serendipity_fetchEntry, but I'm guessing that's what I would use. Is there a reference somewhere that shows the correct usage of all the different serendipity_functions?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: reading the number of comments for an entry by post numb

Post by garvinhicking »

Actually each entry has the number of comments as a seperate column, so you don't need to make any more DB lookups or API calls.

The serendipity_fetchEntry() call returns the full array, check your $entry['comments'] field, which contains the number of comments. :-)

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply