I'm trying to improve the usability of the comments in XOOPS. Technically, the systems works perfect, but it needs two things to make it appealing to users:
- If people are not logged in, they should see a message like "Please login to comment"
- If there are no comments, there should be a message "no comments yet". Otherwise, many non-technical people simply don't understand what the comments section is for.
I resolved one of these two issues, I'm still looking for a solution for the second one. So I have a tip and a question!
TIP: Show "Please login to comment" message below your articles to people who are not logged inI wrote a small howto on how to get that message displayed on your site, it is posted
here. The trick has also been implemented on that site, so you can see how it looks like. I hope it helps more people, it would be great if it would be implemented on XOOPS.org
QUESTION: How do I show a message "no comments yet" when the number of comments is 0I admit, I am a bad programmer, but what I am missing is only one line. In human language, this line should say
"If the number of comments is equal to zero, then..."
I know how to make an if-then construction in PHP, I simply don't know
how to let XOOPS count the number of comments.
And did some research in the templates. I found the lines where the comments are taken from the database, and I expect that a this info is needed to formulate the line:
<{include file="db:system_comment.html" comment=$comments[i]}>
and
<{foreach item=reply from=$comments[i].replies}>
Is there any PHP-guru who can tell me how to count the number of comments so that I can make the if-then construction?? Many thanks!