Stumbled across your Post Comment script today and I like the look of it. Have a few questions to make sure it will be suitable for my site as I don't see these listed on your features page.
1. My website has an index page with lists of the latests news articles (there is no adding comment on this page). is it possible for your script to display the number of comments for each article ie:
2. Is it possible for your script to generate a list of the recently commented articles, so I can say list the 10 most recent articles that have comments on them?
3. Is it possible to integrate the comments box into an existing authentication system. My users who will be able to comment have usernames and will be logged in. Would like the name field pre-populated and no website field. I do not want non logged in members to be able to comment, but see the option to login/regsiter to post a comment. is this possible?
Ideally would not want to make too many modifications to get your script working on my site as this makes upgrade paths harder.
3. This is not possible without modifying the script. You probably can detect if user is logged in with your system and pre-fill form fields (and make them read-only), and hide whole form if user is not logged in.
I do know PHP, so what is involved to be able to return the comment amounts for certain articles. I would do query on my article table to return the newest 25 articles or so. Would I need to do a join on the comments table to get the amount of comments or is there another way. Maybe call that function you listed for each article and pass to it the ID or the file path?
You can execute following MySQL query to get number of comments for each article and their IDs: ---------------code----------------------------------- SELECT count( * ) AS comment_count, what FROM pac2_comments GROUP BY what ---------------code-----------------------------------
Just make sure you've changed pac2_ prefix to suit your table names.
Alternatively, if you're using file paths as IDs, you can get number of comments along with article titles with following code: ---------------code----------------------------------- SELECT count( * ) AS comment_count, pac2_titles.title FROM pac2_comments INNER JOIN pac2_titles ON pac2_titles.uri = pac2_comments.what GROUP BY what ---------------code-----------------------------------
You can add ORDER BY and/or LIMIT statements to order and/or limit your results.
Of course, if you don't use file paths as IDs you can do a query to get articles from your database tables and then call $comments->countComments($id_of_the_article); for each returned article. Please note that script needs to be initialized on a page if you want to call $comments->countComments() function.